winforms

Writing trace information in a windows form app

Hi, I know how to write trace statements that I can view in a webforms environment, but how do I do this in a windows forms app? I am inside of a static method, and I want to display the sql query that it is generating. I don't have access to messagebox.show, what are my options? ...

Can I get the behavior of setting my WinForms form's owner using an hwnd / NativeWindow?

My application is a vb6 executable, but some newer forms in the system are written in C#. I would like to be able to set the C# form's Owner property using a handle to the main application window, so that the dialogs remain on top when tabbing back and forth between my app and other apps. I can get the hwnd of the main application wind...

Cannot access a disposed object named "ParkingWindow"

I intermittently get this in error in my .NET 1.1 C# Windows Forms application. Someone indicated that this is due to a bug in the 1.1 framework and suggests putting the following code into any custom controls. protected override void OnParentChanged(EventArgs e) { if (this.Parent != null) { this.CreateParams.Parent = this.Pare...

Capturing key press messages

We're building some software for an in-house Kiosk. The software is a basic .net windows form with an embedded browser. The Kiosk is outfitted with a mat that the user steps on. When the user steps on the mat, it sends a key comination through the keyboard. When the user steps off the mat it sends a different key combination. What we...

winforms html editor

Anyone know of a good free winforms html editor for .NET. Ideally I would like html and preview modes along with the possibility of exporting to a pdf, word doc or similar. Although the export I could probably create myself from the html output. Another nice feature would be a paste from word that removes all the extra tags you usuall...

User Drawn Controls are using the previous Forms Background.

I have several user drawn controls on a form, unfortunately when the form is shown the user drawn controls are showing the previous forms background rather than the current forms background. The OnPaint event is very simple, and the OnBackgroundPaint event is empty... Like this: protected override void OnPaint(PaintEventArgs p...

C# handle control array event caused by another control

I am working on a winforms html editor with multiple editor windows as each editor window will be written to a database field. I am creating the editor windows as a control array and was hoping to just have one toolbar above them that would handle the events such as apply bold, italic... based on the window I was currently in. Unfortuna...

Visual Studio GUI is see-through?

I'm having some trouble with Visual Studio 2008 on my Windows XP SP2 laptop. What happens is that when I start a program with a few textboxes and stuff like that, the boxes are see-through. I can litteraly see through them and see what's on the underlaying screen. Like if I only have this Form showing and behind that my wallpaper, I can...

Multiple apps sharing same reference data . .

I have multiple winforms applications that download large sets of reference data on startup. I realized that there might be a more efficient way to store this data locally instead of duplicating the memory in everyone one of the applications. This data is used for large drop down pick lists and data mappings. Does anyone have an out o...

Directories or projects . .

On a regular winforms solutions, how do you determine to break classes into different directories / namespaces or seperate projects. Besides binary dependencies should view, controllers, models all be in different projects ? ...

WPF with Windows Forms - STAThread

I am a newbie to WPF and have a couple of questions about WPF and Windows Forms integration. I have an existing Visual C# Windows Forms application. I would like to integrate it with a WPF window, that can be shown on a button click. This was not possible as WPF expects the calling thread to be a STAThread and by default WinForm assu...

Graphs on Windows Forms using C# (.NET 2.0)

Is there an Open Source Free Graph Control for Windows Forms .NET 2.0? ...

Structuring a winforms C# solution

So i am reorganizing a winforms C# solution to help decouple and make it cleaner and more organized. The solution tracks a small business orders,etc . . I have broken out the projects so far into App.View - all GUI Related Code App.Data - just data structures and interfaces. No other implementation code App.BusinessLogic - all busines...

call OpenFileDialog from powershell

When I run the following, PowerShell hangs waiting for the dialog to close, even though the dialog is never displayed: [void] [Reflection.Assembly]::LoadWithPartialName( 'System.Windows.Forms' ) $d = New-Object Windows.Forms.OpenFileDialog $d.ShowDialog( ) Calling ShowDialog on a Windows.Forms.Form works fine. I also tried creating a ...

call FolderBrowserDialog from powershell

Similar to this question, after running the following code the browser dialog does appear with all the correct buttons, but the selection area that usally displays available folders is missing: [void] [Reflection.Assembly]::LoadWithPartialName( 'System.Windows.Forms' ) $d = New-Object Windows.Forms.FolderBrowserDialog $d.ShowDialog( ) ...

Bubbling up events . .

I have multiple layers in an application and i find myself having to bubble up events to the GUI layer for doing status bar changes, etc . . I find myself having to write repeated coded where each layer simply subscribes to events from the lower layer and then in the call back simply raise an event up the chain. Is there a more efficien...

How to access form methods and controls from a class in C#?

I'm working on a program in C#, and right now I have one form and a couple classes. I would like to be able to access some of the form controls(such as a textbox) from my class. When I try to change the text in the text box from my class I get the following error: An object reference is required for the non-static field, method, or pr...

Data-bound TextBox: can't exit

Hi, I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text box). However that's not always the case - when editin...

How do I execute code AFTER a form has loaded?

In .NET, Windows Forms have an event that fires before the Form is loaded (Form.Load), but there is no corresponding event that is fired AFTER the form has loaded. I would like to execute some logic after the form has loaded. Can anyone advise on a solution? ...

How to set the Taskbar Grouping Icon

When my application opens too many windows the taskbar groups them into one button. Each window has its own icon, but the grouping icon is the default "unknown"-kind icon. How can I set the grouping icon? ...