winforms

Any new hope? Making a window an MDI child

Got some C# forms/controls that can be called up either from a C# control on a Winform in a Winforms MDI app OR the same C# control used by a PowerBuilder MDI app via COM. I've been using the WinAPI call SetParent to attach forms to the MDI. It works (or seemed to) in both environments. It lets the child window have its own WindowStat...

Eventhandler override?

I'm trying to come up with a way to easilly detect if a change has been made to a control on a winform. This approach works but it provides no information about what controls have been changed. Is there a way to override the TextChanged event so it will pass and EventArg which contains the name of the control that fired the event? Whe...

Set dropdown direction in WinForms

By default, a winforms dropdown always extends to the right from the dropdown button / menu item. However, I have a toolbox button (similiar to chrome's options button) which is on the far-right side of the window; when clicked, the default menu would always extend outside of the window. Are there any built-in ways to make the menu drop...

Is the Windows Forms AcceptButton behavior in effect when the referenced button is disabled?

With the following: this.AcceptButton = this.OKButton; this.OKButton.Enabled = false; ... will the OK button click handler still be invoked when the user presses Enter? ...

Need to create a custom wizard control.

I have been asked to build a custom wizard control in VB.NET for a windows forms project. It has been made very clear to me that I am not "allowed" to utilize existing wizard controls on the internet due to some obscure logic surrounding copyrights. It has also been made clear to me that we are not "allowed" to use usercontrols in the ...

How to make a form resize vertically and horizontally when a control grows?

(WinForms .net 2.0) I'm making a form which, much like the standard MessageBox, has a single label on it and should grow horizontally and vertically if the text on the label grows. Horizontal seems easy enough, by setting AutoSize = true on the label and the form. However, I also want to make the label grow vertically, ie if it has newl...

WinForms Accept Button Annoyance

I have a base panel class that has (among other things) three buttons. I use subclasses of this base class in two different config dialogues. Both dialogues have an OK button set as the accept button. In one of the dialogues, if I click one of the buttons in the base class, focus immediately returns to the OK button, so pressing the ent...

Adding Existing Form to C++/CLI WinForms Project

I have two C++/CLI projects A and B in separate solutions. I use A for experiments/testing and move the tested code to B once I am finished testing. However, I find that on adding a windows forms class (header, cpp and resx) to project B, I am no longer able to use the visual forms designer of the IDE. How do I enable that? ...

Winforms and VB.net without knowing the basics

Can one learn programming in VB.net using Visual Studio (Winforms stuff) and never learn what a console "hello world" looks like or how, in code, to change which part of the program starts at execution (and other basic things like that) and still be a successful VB.net programmer? Or are there roadblocks just waiting there to be hit? ...

What use is ArrangeIcons in a .Net MDI form.

The MdiLayout enumeration has an value called ArrangeIcons. If this is sent to the LayoutMdi method of a MDI parent form then 'All MDI child icons are arranged within the client region of the MDI parent form.' When I tried putting together a sample MDI form and passing this value into LayoutMdi nothing appeared to happen. What is an MD...

Is there a quick way to get the control that's under the mouse?

I need to find the control under the mouse, within an event of another control. I could start with GetTopLevel and iterate down using GetChildAtPoint, but is there a quicker way? ...

How to detect invalid databinding in a Windows Forms

Visual Studio (2005 Professional), Windows Forms application : I've got a form which contains 8 tabs, each of them containing a few dozen of controls. Each of them is bound to an element of a typed dataset. This great except for the fact that data binding errors can only be found at runtime, and are often silent. Typical case : I have t...

Opening New Form From Event Handler in Main Form Hangs App

I'm trying to open a new form from within an event handler in the main form in a C# program. The event handler gets called properly and it opens the new form, but the new form is frozen and doesn't even initially populate. I can create a button on the main form and have the new form created after the button is clicked, but it is not wo...

Change Color of Button in DataGridView Cell

I have a large DataGridView control that has several cells most of which contain a button. How can I change the color of those buttons? This changes the "outline" of the button but not the button itself. row.Cells[2].Style.BackColor = System.Drawing.Color.Red; This doesn't seem to change anything that's visible: row.Cells[2].Style....

Suspend Redraw of Windows Form

I have a windows form. It contains several datagridviews on it. At some point, the user can press a button which updates the datagridviews. When they do, they can usually sit and watch the datagridview redraw itself, one row at a time. I'd like for the control to not paint until its "done", that is, I'd like a way to tell the control...

My winform app uses xml files to store data, where should I store them so Vista users can write to them?

My winform app uses xml files to store data, where should I store them so Vista users can write to them? Thanks ...

Custom Tab Control not displaying in Visual Studio Form Design View

Hi, So I have an existing project with a custom tab control nested within panels and splitters etc. Now I need to add something to one of the pages of this tab control through the design view. However, when I view the form in question, the tab control is nowhere to be seen (and not in the drop down of current controls on the page). T...

How to make my Windows Form app snap to screen edges?

Anyone out there know how to make your .net windows form app sticky/snappy like Winamp so it snaps to the edges of the screen? The target framework would be .NET 2.0 Windows Form written in C#, using VS08. I am looking to add this functionality to a custom user control, but I figured more people would benefit from having it described f...

MVP/MVC vs traditional n-tier approach for winform apps.

We have a large suite of apps, most are C# 1.1, but at least 10 major ones are in VB6. We are undertaking a project to bring up the VB6 apps to .NET 3.5. All the c# 1.1 apps are written using a traditional n-Tier approach. There isn't really any architecture/separation to the UI layer. Most of the code just responds to events and g...

How do I unload all open forms in VB.NET?

In the middle of converting VB6 code to VB.NET, I need to replace the following code that intends to close all open forms remaining in the application. 'close all sub forms For i = My.Application.OpenForms.Count - 1 To 1 Step -1 'UPGRADE_ISSUE: Unload Forms() was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local...