winforms

Separate UI thread for details view using WinForms

Our app's master/details view uses a datagridview as the master, and a custom control as the details view. The details view takes a long time to compute and render, making cursoring up/down the master view painfully slow. Therefore, we'd like the details view to run asynchronously (in a separate UI thread) with change notifications from...

How can I simulate a tab control?

I want to have buttons that kind of act like tabs - they switch between "pages" of the application. How can I achieve this effect? I'm thinking that I could just put the controls in some kind of container and toggle the visible attribute, but is that plausible? I am using WinForms. The reason I don't want to use a tab control is becaus...

Is creating an inheritance chain of WinForms going to bite me?

Suppose I have a base form Main1 which may need to be altered slightly, including perhaps adding additional Controls and altering the size/location of existing Controls. Those base Controls which I need to alter I set to 'protected' in the designer. So I have another form, Main2, that derives from Main1. Then I have another form, Main...

Why does the designer need System.ComponentModel.ISupportInitialize in a Winform ?

I can build a winform with controls without ever using ISupportInitialize why do the designer need it ? ...

Is it 'wrong' to make User Controls if it is not for resuability?

I can't decide if it is good or bad to make many user controls. I am only doing it cause I find it easier to work on a control where there are not a lot of components. If something needs to be fixed it is also easier. Kind of like how you split your program up in a lot of classes. However multiple controls adds a bit more complexity wh...

How to avoid leaking handles when invoking in UI from System.Threading.Timer?

It seems like calling Invoke on a winforms control in a callback from a System.Threading.Timer leaks handles until the timer is disposed. Does anyone have an idea of how to work around this? I need to poll for a value every second and update the UI accordingly. I tried it in a test project to make sure that that was indeed the cause o...

How can I set the tab order in VB.NET?

I have a bunch of buttons on a form and when the person presses TAB I want the focus of the controls move in a specific order. Does anyone know how to do this? ...

How can I make a control resize itself when the window is maximized?

I can't seem to figure this out. I have two group boxes on the left side of my form window. When the window is normal size (1000x700), the two boxes are the same. However, when the window is maximized, it ends up looking like this: What I want is for both the "Log" group box and the tab control to extend down to the bottom of the windo...

Winforms: Is there a way to be informed whenever a form gets opened in my application?

I have a "Switch to window" button on my main form that I'd like to be enabled only when other windows (in my app) are open. Is there some sort of event that is raised whenever a form is opened or closed that my main form can hook? (For example, perhaps some sort of way to track when Application.OpenForms has changed?) (I understand tha...

How should I do a navigation screen in WinForms?

Hi, I want to build a navigation screen, just like installation shields has (next/previous stuff), maybe a bit more sophisticated.. How is this usually done in WinForms? thanks :) ...

How to provide Prompt Lists in an NHibernate WinForms application

Background WinForms application using NHibernate. Application is in MDI style and each MDI child form opens a new NHibernate session at Load which remains open for the life of the form. Question My application is basically an "order management" or "purchasing" system. One particular form uses a lot of "lookup" lists. Like a list o...

Custom ListView in Winforms?

Is it possible to draw some strings onto a listview? I overridden the OnPaint event but I don't see any change. I checked out some code on custom listview, but it seems like people are using p/invoke, etc. Why? Isn't list as customizable as other winforms, like the Button control? I am not gonna customize wildly, just paint some more ...

Custom-drawn control won't render controls behind it even though it's transparent

I'm currently writing a custom-designed tab control. I created my own control instead of owner-drawing the TabControl because I figured it'd be faster and more flexible. My tab control styles itself after the VS2008 tab control; that is, when a tab is selected, part of that tab is in front of other, unselected tabs. My tab control consi...

How can I access to system icons like "folder", "file" etc.?

Hi, I would like to use standard icons in treeview but I am not sure where to get them? I tried different places like resources etc., but without luck. thank you ...

How do I call a .NET windows app that has been installed from a publish?

If I publish two separate C# Windows forms apps to a server, and a user installs both of these apps on their machine, how would I get one app to call the other (possibly with parameters) from a button click? I don't really understand all this publish and manifest business - the exe doesn't seem to physically exist on the user's pc, so h...

Customizing Print to File in WIndows

I have a requirement where my client want to install a custom "Print to File" printer (apparently MS has an SDK for this?). They want to be able to install this as a kind of "application" so that if someone chooses to print to this printer, they have to answer a few questions, and the file gets "printed" to a path of our choosing. (we ...

Windows Forms .NET 3.5 using resource images for a Treeview control

Hello SO, When populating my treeview I would like to use the same images that I use in my toolbar etc which are stored in a resource file. The treeview seems to on accept images via an image list. I was thinking of reflecting and adding the resources to an image list on load... How do you guyz n girlz generally do this? ...

Taking over someone else's code

I am taking over someone elses code. What are some good ways to learn what that programmer did as quickly as possible? I have been running it, stepping through it and looking at the callstack. What else can I do? Sorry I forgot to mention, but there is little documentation and I have been trying to fix simple problems. Thanks! ...

How can I use a foreach loop to delete all of the control in a panel?

Here's the code I have: private void ClearSearchResults() { foreach (Control X in panel1.Controls) { panel1.Controls.Remove(X); } } The problem is, when I run this method, only a single item is deleted, then if I click on a button again so the method can run again, another is deleted. If I ...

How to add things to a menustrip programatically?

I want to add whatever is written in a textbox to a menustrip. In the File > Recent Searches thing I have. How can I do programatically? And can I assign an event handler dynamically so that when a user clicks on X item in that subfolder, the text is copied BACK to the textbox? EDIT: How can I programatically call on the folder Busqued...