winforms

Get Exitcodes from WindowsForms Application in command window

Hi, I'm starting a Windows Forms application from the command promt and I need to get the exit codes that the windows forms application generates. The command promt starts the application and returns immediatly. But the application executes in the background. Is there a way to get the Exit codes? Kind Regards Christian. ...

How to get mouse position over a certain control

Windows Form I'm using the DragOver event on a layoutpanel and the DragEventArgs returns the X/Y coordinates of the mouse in relation to the screen. I know there is a function to translate this in to the position of the mouse over the control, but I'm having difficulty locating it. ...

Winforms DataGridView Refresh Problem

Hi Guys, I have two Datagridviews in a tab and the datasource of the second grid is based on the row selection in first grid. The problem is I cannot get the grid to refresh after some values have been inserted or updated in the prior tabs. It works fine if I click on the row but it is not working if I select the row programmatically (i...

SQL table change distribution

I have a WinForm application built with VS 2008 (C#) and SQL Server Express 2008 that is currently deployed on test users PC. I have modifications to do on the database structure (add fields, tables, etc.) and I wonder what's the best method to distribute the changes on the users PC (without loosing the users data). From what I've lear...

Windows design guidelines and Visual Studio

Does anyone have a good strategy for adhering to Windows Design Guidelines with Windows Forms development in Visual Studio (2008) For example just tring to adhere to font recommendations in Windows XP you have to know the system default font should be Tahoma, Verdana should be used for Title bars in floating windows and Trebuchet MS sh...

How do I add or remove columns from a Data Grid View dynamically

I have a DataGridView form in my .NET application and I'd like to be able to show or hide additional columns based on a Boolean value at run time. What's the best way to show/hide these columns in code (as opposed to in the Forms Designer)? ...

WinForms Multiline Textbox, Enter key insists on moving focus out of textbox.

I've got a multiline textbox and a button below it. VB.NET, WinForms, .NET 2.0 System.Windows.Forms.Textbox Multiline = True AcceptsReturn = True AcceptsTab = False CausesValidation = False No Events explicitly coded. I'd like the Enter key to insert line-feeds and never move the focus to the next control (the button). I'd like ...

Memory Leak in Custom Cursors

I'm trying to track down a memory leak and I think it has to do with the custom cursor images being used. A new cursor seems to get created and displayed every time a certain object is dragged around on the form, but I can not find anywhere it is being disposed. I've read that it needs to be destroyed, but I'm not sure how to go about ...

How do I create an automatic UI event trace in winforms?

I need to take an existing winforms application and drop into an event tracing mode, with hopefully as little friction as possible. I would like to see every action the user takes as a simple stack trace-looking thing: MainForm.LaunchThing_Click ThingWindow.NameInput_Focus ThingWindow.NameInput_TextChanged ThingWindow.AddressInput_Focu...

.NET form that preserves text fields across sessions?

Its a simple config app with 4 checkboxes and 5 textboxes, and all values must persist across sessions. do I have to serialize the fields and restore them by hand? I really have no idea the best way to approach this. ...

Winform Not Displaying in Designer

I have a Managed C++ WinForm that suddenly stopped showing in the VS 2005 designer. The error it shows is Could not find type 'int'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built. I don...

Konami Code in C#

I am looking to have a C# application implement the Konami Code to display an Easter Egg. http://en.wikipedia.org/wiki/Konami_Code What is the best way to do this? Update 1 This is in a standard C# windows forms app. ...

How does one databind a custom type to TextBox.Text?

I have a custom c# type like (just an example): public class MyVector { public double X {get; set;} public double Y {get; set;} public double Z {get; set;} //... } And I want it to databind to TextBox.Text: TextBox textBox; public MyVector MyVectorProperty { get; set;} //... textBox.DataBindings.Add("Text", this, "MyV...

process.WaitForExit() asynchronously

I want to wait for a process to finish, but process.WaitForExit() hangs my GUI. Is there an event-based way, or do I need to spawn a thread to block until exit, then delegate the event myself? ...

C# : How do I get the actual item clicked from SelectedIndexChanged for a ListView control?

I'm working with a winForms app that has a listView. That listView has multi-select enabled and I have many, many items in the list (in row view). When I select the last row (i.e. item), then shift-click the 5000th row, SelectedIndexChanged fires 5000 times. If this happens, I end up in a very nasty loop. The last row clicked is not g...

Main UI windows not updating control -Cross-thread operation not valid

Ok..here is the problem I have a main UI form that has a control container that i can add some buttons item to it,and also i have a backgroundworker object that starts up a listner. When the listner events fire, i would like to create a button in that control container on the main UI form. Everything seems to work fine until i try to ad...

Winforms WPF Interop - WPF content fails to paint

I have a Winform that uses an ElementHost to display a WPF UserControl. Once every 50 times or so when the form loads the WPF content fails to paint. You can see through the Winform chrome to whatever is beneath. Resizing the window gets the WPF content to show up. Is this a known issue? Can anyone suggest a workaround? Thanks Scott ...

WinForms- Populating a FlowLayoutPanel with a large number of controls and painting thumbnails on demand

Hi, I'm trying to make an ImageListBox kind of control that will display large numbers of thumbnails, like the one that Picasa uses. This is my design: I have a FlowLayoutPanel that is populated with a LOT of UserControls, for example 4,000. Each UserControl is assigned a delegate for the Paint event. When the Paint event is called, i...

C# WinForms Naming Convention

Is there any kind of naming convention for C# WinForms code? I Googled this a bit and got nowhere fast. I'm designing a WinForms app and the Class View is becoming tough to navigate fast, so I need to apply some standards to find things faster. New (typical) control When you drag a new control onto a form in VS, it assigns it a camel ...

Smart Client Maximize a view in tab workspace

My question may not make sense but I have valid reason. We use .net smart client framework with CAB to develop window based application. We have a trend view (smart client view) which plots graph of live data. We use ProEssentials graph control for the same. Trend view is tabbed with a tab workspace. But the client want to maximize th...