winforms

When creating a new GUI, is WPF the preferred choice over Windows Forms?

Most restrictions and tricks with windows forms are common to most programmers. But since .NET 3.0 there is also WPF available, the Windows Presentation Foundation. It is said that you can make "sexy applications" more easy with it and with .NET 3.5 SP1 it got a good speed boost on execution. But on the other side a lot of things are wo...

Open a URL from Windows Forms

I'm trying to provide a link to my company's website from a Windows Form. I want to be well behaved and launch using the user's preferred browser. What is the best way to open a URL in the user's default browser from a Windows Forms application? ...

Can you recommend low cost automated testing tools for a .NET Winforms application?

Looking for an automated testing tool to support functional/regression testing for a .NET Winforms client server commercial application. The top tier products: HP QuickTest Pro, Borland SilkTest, IBM Rational Functional Tester and Compuware TestPartner are in the 5-10K price range. Would you recommend a lower cost tool set for function...

Showing a tooltip for a MenuItem

I've got a menu that contains, among other things, some most-recently-used file paths. The paths to these files can be long, so the text sometimes gets clipped like "C:\Progra...\foo.txt" I'd like to pop a tooltip with the full path when the user hovers over the item, but this doesn't seem possible with the Tooltip class in .NET 2.0. ...

Optimize Windows Form Load Time

I have a Windows Form that takes quite a bit of time to load initially. However, each subsequent request to load the Form doesn't take as long. Is there a way to optimize a Form's load time? ...

MapPoint 2009 Load Performance

I'm having some problems integrating MS MapPoint 2009 into my WinForms .Net 2.0 application in C#. I've added the ActiveX MapPoint control onto a form and have no problems getting it to display a maps and locations; my concern is the time it takes to load a map once it is created. The tests on my development machine have shown the av...

Listview background drawing problem C# Winform.

I have a little problem with a Listview. I can load it with listview items fine, but when I set the background color it doesn't draw the color all the way to the left side of the row [The listViewItems are loaded with ListViewSubItems to make a grid view, only the first column shows the error]. There is a a narrow strip that doesn't pa...

How to run executable at end of Setup Project?

I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way to get the Setup Proj...

How to get entire chain of Exceptions in Application.ThreadException event handler?

I was just working on fixing up exception handling in a .NET 2.0 app, and I stumbled onto some weird issue with Application.ThreadException. What I want is to be able to catch all exceptions from events behind GUI elements (e.g. button_Click, etc.). I then want to filter these exceptions on 'fatality', e.g. with some types of Exceptions...

Rolling your own message loop, any pitfalls?

This question is slightly related to this question about exception handling. The workaround I found there consists of rolling my own message loop. So my Main method now looks basically like this: [STAThread] static void Main() { // this is needed so there'll actually an exception be thrown by // Application.Run/Application.DoEvents...

How do I make a ListBox refresh its item text?

I'm making an example for someone who hasn't yet realized that controls like ListBox don't have to contain strings; he had been storing formatted strings and jumping through complicated parsing hoops to get the data back out of the ListBox and I'd like to show him there's a better way. I noticed that if I have an object stored in the Li...

Error consuming Web Service from Winform App - "Cannot execute a program..."

I have a winform app that calls a web service to check for updates. This works in dev and it also works everywhere else I've tried it, just not on the installed copy on my machine (which happens to be the same in dev). The error is: Cannot execute a program. The command being executed was "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727...

Setting the namespace of a WinForms UserControl in VB.NET

How do you define your UserControls as being in a namespace below the project namespace, ie. [RootNameSpace].[SubSectionOfProgram].Controls? Edit due to camainc's answer: I also have a constraint that I have to have all the code in a single project. Edit to finalise question: As I suspected it isn't possible to do what I required so ca...

How to implement the Edit -> Copy menu in c#/.net

Hi, How do I implement a Copy menu item in a Windows application written in C#/.NET 2.0? I want to let the user to mark some text in a control and then select the Copy menu item from an Edit menu in the menubar of the application and then do a Paste in for example Excel. What makes my head spin is how to first determine which child f...

Any recommendation for a good enough Winforms GUI design?

I am developing a mid-size application with VB2008. To better test my application I am following a MVP/Supervising Controller approach. My question is: What are your recommendations to separate responsibilites? So far I've come up with a winform with an instance of a controller and with an instance of my class. The controls are updated ...

Programatically show tooltip in winforms application.

How can I programatically cause a control's tooltip to show in a Winforms app without needing the mouse to hover over the control? (P/Invoke is ok if necessary). ...

VS2005 C# Programmatically change connection string contained in app.config

Would like to programmically change the connecton string for a database which utilizes the membership provider of asp.net within a windows application. The system.configuration namespace allows changes to the user settings, however, we would like to adjust a application setting? Does one need to write a class with utilizes XML to modify ...

What are my options for having the RadioButtonList functionality of ASP.NET in WinForms?

Is this type of control only available in a 3rd-party library? Has someone implemented an open source version? ...

Flickering during updates to Controls in WinForms (e.g. DataGridView)

In my application I have a DataGridView control that displays data for the selected object. When I select a different object (in a combobox above), I need to update the grid. Unfortunately different objects have completely different data, even different columns, so I need to clear all the existing data and columns, create new columns and...

Windows Form Ordering using MDILayout

Hi, I have a very specific problem using C# and a Windows MDI Form application. I want to display two (or more) images to the user, a 'left' and a 'right' image. The names of the images are concealed from the user, and then the user selects which image they prefer (this is part of a study involving medical image quality, so the user ha...