winforms

Autoupdating .net applications

I've written 2 reasonably large scale apps in .net so far, and both of them have needed an updating facility to automatically update the application when I roll out new code. I've found the 'Enterprise application block updater' a bit too complex for my needs, and I've found 'click once' frustrating when it comes to publishing. The mos...

How often do you use System.Component.BackgroundWorker in your UIs ? (if ever)

I am sure a responsive UI is something that everyone strives for and the reccomended way to do stuff is to use the BackgroundWorker for this. Do you find it easy to work with ? Do you use it often ? Or do you have your own frameworks for lengthy tasks and reporting process. I have found that I am using it quite a lot and even using it...

TreeView Drag & Drop help - _Invalid FORMATETC structure_ exception

Hi, I'm trying to implement Drag & Drop functionality with source being a TreeView control. When I initiate a drag on a node, I'm getting: Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC)) The ItemDrag handler (where the exception takes place), looks like: private void treeView_ItemDrag(object sender, ...

Font-size independent UI: everything broke when I switched to 120 DPI!?

So I was reading those Windows Vista UI guidelines someone linked to in another question, and they mentioned that you should be able to survive a switch to 120 DPI. Well, I fire up my handy VM with my app installed, and what do we get... AAAAGH!!! MASSIVE UI FAIL! Everything's all jumbled: some containers aren't big enough for their tex...

Context Menu Resets ComboBox's SelectedIndex

I have a ContextMenu that is displayed after a user right clicks on a ComboBox. When the user selects an item in the context menu, a form is brought up using the ShowDialog() method. If frmOptions.ShowDialog() = Windows.Forms.DialogResult.Cancel Then LoadComboBoxes() End If When that form is closed, I refresh all the...

How do you Modify TextBox Control Tab Stops

When you use a Windows Forms TextBox, the default number of tab stops (spaces) is 8. How do you modify this? ...

How do I find out if a process is already running using c#?

I have C# winforms application that needs to start an external exe from time to time, but I do not wish to start another process if one is already running, but rather switch to it. So how in C# would I so this in the example below? using System.Diagnostics; ... Process foo = new Process(); foo.StartInfo.FileName = @"C:\bar\foo.exe";...

Can you load a .Net form as a control?

I want to load a desktop application, via reflection, as a Control inside another application. The application I'm reflecting is a legacy one - I can't make changes to it. I can dynamically access the Form, but can't load it as a Control. In .Net Form expands on Control, and I can assign the reflected Form as a Control, but it throws ...

Activating the main form of a single instance application

In a C# Windows Forms application I want to detect if another instance of the application is already running. If so, activate the main form of the running instance and exit this instance. What is the best way to achieve this? ...

How do I create tri-state checkboxes with a TreeView control in .NET?

I have a treeview control in a Windows Forms project that has checkboxes turned on. Because the treeview control has nested nodes, I need the checkboxes to be able to have some sort of tri-mode selection. I can't find a way to do this (I can only have the checkboxes fully checked or unchecked). ...

Is WindowsFormsHost fit for purpose (.net WPF hosting WinForms)?

A GUI driven application needs to host some prebuilt WinForms based components. These components provide high performance interactive views using a mixture of GDI+ and DirectX. The views handle control input and display custom graphical renderings. The components are tested in a WinForms harness by the supplier. Can a commericial applic...

Getting the back/fwd history of the Windows Forms WebBrowser Control

In C# WinForms, what's the proper way to get the backward/forward history stacks for the System.Windows.Forms.WebBrowser? ...

Opening a PDF in WPF Application

Hi, Any ideas how to open a PDF file in a WPF Windows Application? ...

Embed a File Chooser in a UserControl / Form

I've inherited a desktop application which has a custom .NET file chooser that is embedded in a control, but it has some issues. I'd like to replace it with a non-custom File Chooser (like the OpenFileDialog). However, for a variety of reasons it needs to be embedded in the parent control not a popup dialog. Is there a control I'm miss...

Create drop down list options from enum in a DataGridView

I currently have a class and I'm trying to create an easy GUI to create a collection of this class. Most of the attributes of this class are strings. However, one of the attributes I want the user to be able to set is an Enum. Therefore, I would like the user interface, to have a dropdownlist for this enum, to restrict the user from ent...

Windows Forms Designer upset by a control with a nullable property

Hi, I have a "numeric textbox" in C# .NET which is nothing more than a derivation of Textbox, with some added logic to prevent the user entering anything non-numeric. As part of this, I have added a Value property of type double? (or Nullable<double>). It's nullable to support the case where the user doesn't enter anything. The control...

UI Thread Safety

Any suggestions on the best way to ensure thread safety when changing the properties on Form controls? I have been using Me.Invoke in the past, and I was wondering if you have pros/cons, comments, suggestions, etc. ...

ToolStrips in TabPages frequently disappear from Windows Forms designer

I have a Windows Form app with a TabControl. One of the TabPages in the TabControl contains a ToolStrip. Frequently, the Windows Form designer will spontaneously set the Visible property of the Toolstrip to False. To get the toolstrip to reappear in my form, I have to manually find the control and set the property back to True. It's real...

Upgrading from .NET 1.1 to .NET 2.0, what to expect?

I'm working on a big .NET 1.1 project, and there exists a wish to upgrade this, majorily to be able to use better tools like Visual Studio 2008, but also because of the new features and smaller amount of bugs in the .NET 2.0 framework. The project consist for the bigger part of VB.NET, but there are also parts in C#. It is a Windows For...

BufferedGraphicsContext Error

I am getting the below error and call stack at the same time everyday after several hours of application use. Can anyone shed some light on what is happening? System.InvalidOperationException: BufferedGraphicsContext cannot be disposed of because a buffer operation is currently in progress. at System.Drawing.BufferedGraphicsContext.Dis...