winforms

What is the best way to manage Form state?

I'm developing a form in a C# .NET 2.0 application that contains complex logic regarding the state (enabled/disabled) of various controls on the form. (The design is a symptom of a business analyst's poor understanding of UI best practices.) What would be the best way to go about managing the "state" of the form? Normally, I've seen...

How to detect if app is started from VisualStudio?

Hello, I've got one quick question. Is there any simple way to detect if .net 2.0/3.x winforms application is run from visual studio (in any configuration debug/release/custom) ? Best regards, Tomasz. ...

Refactoring WinForm ClickNCode to MVP Passive View

I'm attempting to refactor an existing Winform application to use the MVP Passive View pattern. The application's UI, business logic and data storage code have been freely intermingled for years. It looks like it either started out with separate layers or someone attempted to separate it into layers. In any case the layer boundaries were...

Draw a single pixel on Windows Forms

I'm stuck trying to turn on a single pixel on a Windows Form. graphics.DrawLine(Pens.Black, 50, 50, 51, 50); // draws two pixels graphics.DrawLine(Pens.Black, 50, 50, 50, 50); // draws no pixels The API really should have a method to set the color of one pixel, but I don't see one. I am using C#. ...

VS2005 Winforms Designer Exception Screen and IE8

It seems since I installed Internet Explorer V8 that my Winforms Designer Exception screen (WSOD) is broken. Where before I would get red text with the error described, today I get this: Can anyone suggest to me a way to recover the text view of this display, I'm wasting time trying to read the reason the Winform file won't display ...

How do I change the title of ColorDialog?

I'm spinning up a ColorDialog component in WinForms to let the user select a particular custom control's chart's background color and foreground color. Both configuration options are on the same page of the configuration dialog, so I want to set the title of the color dialog to "Background Color" when the dialog is brought up to change ...

System.Data.OleDb.OleDbException: Too many fields defined

I'm working on building a .NET WinForms application to replace a series of forms in a Microsoft Access (insert collective groan here) database. In an effort to get the initial version finished, I am attempting to use the existing queries rather than digging into the data model and its obvious design problems. I'm calling the queries us...

How to automatically convert VS2003 classes to partial Designer.cs files?

I'm upgrading a project from Visual Studio 2003 to 2008 and wish to automatically generate XXX.Designer.cs files and update the corresponding XXX.cs original one. Any automatic way to do it? UPDATE: I'm referring to WinForms. Of course, I know the old style works but i'm looking for a way to go to the new style without doing it by hand...

drag and drop in winforms or wpf

i would like to create a simple winforms or wpf application where i can drag and drop virtual "cards". this below is not exactly what i want to do, but it the closest thing that i found on the web to represent the user interface. http://www.greenpeppersoftware.com/confluence/plugins/advanced/gallery-slideshow.action?imageNumber=1&p...

DataGridView item double click

I have a DataGridView in a Windows Form. I want to handle double click events on each cell to display a detail form related to that record. Unfortunately, the double click event is executed when you double click on column headers. What should I do? ...

winforms application memory usage

is there anyway i can have my application tell how much memory the user has and if the application is getting close to taking up a high percentage of that. also, how do you know how much memory the machine gives to OS, video cards, etc . . for example, if you have 4gb of memory, how much actual memory is given to applications, can you ...

How to have no/one window title and have a different title for the task bar?

Windows Explorer in Windows 7, and maybe Vista too (can't rememmber), does not have a title in the window. but does have a title (some text) in the taskbar. Is this possible to reproduce in C# (wpf or winforms)? either through the framework or introp. I want to have a window that says "Options" in the taskbar but the window itself does...

C# Listbox Bound to Entity "Entity Framework"

On my WinForm, I bound my listbox to a Table in Entity on EDMX, but when the table data is changed, I tried to call myListBox.DataSource = Entities.table; myListBox.ResetBindings(); myListBox.Refresh(); but nothing happens in ListBox. The Entities.table object holds the right data though, it just doesn't reflect on the ListBox. Any ...

How can i get messages in C#?

Hello, How can I get a specific message on a specific method? I've seen some examples and people use "ref" ,but I dont understand it. In delphi,for example,my function(method) must be declared in the Main Form class and next to the declaration I have to put the message type TForm1 = class(TForm) ... protected procedure Me...

How to get the Handle of the form with get{set?

Hello, I'd like to get the handle of my form from a different class(probably thread). I want to do it the way I do invoke public int GetHandle { get { if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { return this.Handle.To...

How to move object on the screen

Hi how I can move any Object on screen in WinForm ? When I press right -> the object will move right until i'll press any other arrow key and when I press left <- the object will move left until i'll press any other arrow key The object all the time will be in motion (like in the Snake game) thank's in advance ...

Dockable autohiding panel control for Windows Forms

Hello, I'm creating a Windows Forms application and I'd like to have a similar look and feel to SQL Server's Management Studio, i.e. a nice autohiding and dockable panel on the left. A similar control is Visual Studio's "Toolbox". What sort of control is Management Studio's Object Explorer? And where can I get one? I'm using .NET 3.5 ...

List of user controls in similar to WPF ItemsControl

I have two lists of data. To represent an "item" I have a custom UserControl (as the item has multiple fields and I want to lay it out correctly on the UserControl). I would like the list to be populated on some type of ListBox by these user controls instead of strings. I have seen people do this in WPF using ItemsControl or some repea...

Fill Text Forms AND Clickable text forms In C#

I have a windows form application I have a button that opens the SaveFileFrom dialog private void button1_Click(object sender, EventArgs e) { SaveFileDialog savefileDialog1 = new SaveFileDialog(); savefileDialog1.ShowDialog(); } I was wondering how I could put the file that is chosen in a text box even like so private void textB...

highlight selected item in flowlayoutpanel

how do i highlight the selected item (in my case, a custom user control) in a flowlayoutpanel ...