winforms

How do I override the error message on a databound control in WinForms?

I have a form in my application that uses a binding source to bind the controls to a model object. This works, and handles basic validation such as ensuring that the user doesn't enter text into a numeric field, for example. I am using an ErrorProvider, and setting its datasource = the binding source in order to display the error messag...

Good Quality Free Gridview for .NET WinForms

Is there a good quality free Gridview for .NET WinForms? The Xceed datagrid (express edition) is lovely, but is for WPF. It's nice and simple, isn't overwhelming in the features department, and looks great at the click of a button. I'm looking for something similar for WinForms. ...

Dotnet upgrade - 2.0 to 3.5 - performance

we have a number of winforms apps that are written in dotnet 2.0. are there any performance upgrades that we would expect when moving to 3.5 runtime. Any particular benefits besides the language features ...

How can I make a ElementHost transparent so that the form behind it is visible and clickable?

I tried to derive a class form ElementHost and overiding the CreateParams method: protected override CreateParams CreateParams { get { const int WS_EX_TRANSPARENT = 0x20; CreateParams cp = base.CreateParams; cp.ExStyle = cp.ExStyle | WS_EX_TRANSPARENT; return cp; ...

C#: Activate a TextBox when user starts typing

I want to activate a search textbox when the user starts to type something (even if the textbox isnt focused right then). I have come as far as setting KeyPreview on the form to true. Then in the KeyDown event handler, I have this: if(!searchTextBox.Focused) { searchTextBox.Focus(); } This almost works. The textbox is focused, but...

Allowing title bar double click to maximize a dialog but without max-min buttons

This is a little C# specific. The default behaviour of a resizable dialog box is that title bar click maximizes the dialog and a second double click restores the size. However what I want is to have the Help button turned on, which means the minimize and maximize buttons are hidden, but would still like the title bar double click behavio...

Horizontal scroll position when a winforms treevew item is selected

We have some code that uses the .net Windows.Forms.TreeView. When an item in the view is selected then code does treeView.BeginUpdate(); // ... some stuff ... SendMessage(treeView.Handle, WM_HSCROLL, SB_LEFT, 0); treeView.EndUpdate(); This is so that the tree view display doesn't scroll right (which is the default behaviour - to show ...

Launching a .Net winforms application interactively from a service

Environment - VS2008, Vista SP1. I have written a process management service which can launch applications either in session 0 or the interactive console (usually 1). Please note this is NOT the normal mode of operation, it's for in-house debug purposes only. In the field, these processes will be safely hidden away in session 0. Securit...

Adding controls to User Controls dynamically

Hi, I want to add a control to a user control in an event handler (like a button click event). I'm trying to add a datagridview lookup control dynamically, but I couldn't get that to work, so I tried just adding a button with this code: private void btnCreateNewButton_Click(object sender, EventArgs e) { Button btn = new Button(); ...

Context menu

Hi In C# windows form application, I want to add item to context menu so that I can check or uncheck that item in context menu. Is it possible? ...

What winforms control to display message with minor html formatting?

Is there a control I can use to display a short message that contains minor html formatting (eg one or more links). I'd prefer not to use the WebBrowser control (suggested here) as it's a bit heavy for what I want, so any other suggestions welcome. If a user does click a link from my message I want it to be opened in their default brow...

Winforms &TimeSpan - Which control works best ?

I am building a form with winforms - and should add a view and editable time span value. Which controls works best for this ? A normal edit control shows the value correctly -> but it's not really nice for changing values the normal date time picker doesn't work the masked edit control doesn't have got any standard mask for this Doe...

Updating Dataset Without Affecting The Datasource

I want to add a new column to my dataset without affecting the underlying database. That new column will be updated from my WinForm. How to do changes (add column, do updates, etc) on a dataset without affecting the database? ...

c# Threads and display update

Hi! I have a Windows Form with a label and a picture box. To retreive an image from a web service I use a thread. The user click on a button and first the label must be displayed and then new thread is started to retrieve the image. This is the code: private void menuItem1_Click(object sender, EventArgs e) { etiquetaCargando.Visible...

How do I create a class with asynchronous capabilities (similiar to SqlCommand or WebRequest)?

I've been reading a lot about asynchronous programming recently, as I need to create a multi-threaded application. Unfortunately I can't seem to bring my newly acquired knowledge together into one cohesive and useful unit! I'm hoping someone can give me some pointers on how to construct the following: I have a class that does a lot ...

Getting a list of file associations

I have a program that is supposed to save reports in different file formats, and if there is an application associated with the file extension, then open that file using that application. Is is possible to get all file extensions that have applications associated with them in windows? I tried the registry entry HK_CLASSES_ROOT{extensi...

Is there a free "Add Connection" or "SQL Connection" Dialog?

I like the "Add Connection" or "SQL Connection" dialog that is in Visual Studio in Server Explorer window. I also like the one in CodeSmith. I would like to have that same dialog or simular functionality in my windows application. I need it to work with SQL Server, and SQL Server Express Database files (*.mdf). My clients have .NET 3....

WPF Window Drag/Move Boundary

Hi everyone, just curious if you know of any way to setup a drag boundary for a window? It would be nice to have these properties: Me.MinLeft = 10 Me.MinTop = 10 Me.MaxLeft = 150 Me.MaxTop = 150 Those are made up properties, btw, which would be nice to have. I know I could probably setup a timer to fire ever 10th of a second and che...

How do I use different Fields in the same column in a DataGridView

I have a, probably unique situation in which I need to use a single column for two different alternating values. My data has seperate columns for date and time. Not my choice, I have to live with it. Rows are displayed in "pairs" Row 1 and 2 are part of the same functional unit, but they are seperate rows in the database. In the gri...

Unauthorisedaccessexception - how to gain access?

I have a winform application to compress and move some files. When I try to access a path on my desktop, I get an unauthorisedaccess exception. I am running visual studio as administrator (says that in the program bar) and I am a full admin on my machine (can access other accounts, etc). How can I acess this path (folder)? One of the pr...