winforms

Should the Enter key always trigger the default button, no matter which child control has the focus

I have a form with a default OK button, and a Cancel button. I have a treeview with nodes that can be edited, i.e. you can double-click them or press F2 to open another form. Now, I've never liked that F2 shortcut, and now that I'm enabling treeview label edition, it's even worse. My first reaction when testing the form was to press "En...

Hiding the header on an Infragistics Winform UltraCombo

I've gone through just about every property I can think of, but haven't found a simple way to hide the header on a winform UltraCombo control from Infragistics. Headers make sense when I have multiple visible columns and whatnot, but sometimes it would be nice to hide it. To give a simple example, let's say I have a combobox that displ...

Datagrid usage sourced from SQL server.

I would like to know the best way to use a datagrid control linked to a combination (join) of data tables in a way that both simply allows both display, creation of new rows in underlying tables and deletion. The datagrid appears to offer the latter capabilities but I have not found a way that I am happy with to do more than just displa...

Windows Forms: How do you change the font color for a disabled label

I am trying to set the disabled font characteristics for a Label Control. I can set all of the Font characteristics (size, bold, etc), but the color is overridden by the default windows behavior which seems to be one of these two colors: If background color is transparent then ForeColor is same as TextBox disabled Color. If background...

Trouble when adding a lot of Controls to a .NET Windows Form (C#)

I have a Windows Form app written in C#. Its job is to send messages to a list of users. While those messages are being sent, I'd like to display status of the operation for each user. What I am doing (for each user) is creating a Label control and adding it to Panel. This works without a problem for a small set of users. When I incr...

How can I retrieve latest from database using NHibernate after an update?

Here is the scenario: I have a winforms application using NHibernate. When launched, I populate a DataGridView with the results of a NHibernate query. This part works fine. If I update a record in that list and flush the session, the update takes in the database. Upon closing the form after the update, I call a method to retrieve a ...

Do you databind your object fields to your form controls?

Or do you populate your form controls manually by a method? Is either considered a best practice? ...

auto update for winforms application

When creating an auto updating feature for a .net winforms application, how does it update the .dll's and not effect the currently running application? Since the application is running during the update process, won't their be a lock on the .dll's (because those .dll's will have to be overwritten during the update. ...

How to deal with .NET TabPage controls all ending up in one Form class?

I'd like to structure a Form with a TabControl but I'd like to avoid having every control on each TabPage end up being a member of the Form I'm adding the TabControl to. So far I've identified these options, please comment or suggest alternatives: 1) Write a UserControl for each TabPage 2) Leave only the Control on the main Form but tu...

How can I open a window's system menu by code?

I have a C# WinForms borderless window, for which I override WndProc and handle the WM_NCHITTEST message. For an area of that form, my hit test function returns HTSYSMENU. Double-clicking that area successfully closes the form, but right-clicking it does not show the window's system menu, nor does it show up when right-clicking the windo...

ASP.NET Validation Controls and Javascript Confirm boxes

I have a page using .NETs server-side input validation controls. This page also has a javascript confirm box that fires when the form is submitted. Currently when the Submit button is selected, the javascript confirm box appears, and once confirmed the ASP.NET server-side validation controls are fired. I would like to fire the server-...

How to implement sorting in a listview while maintaining neighboring columns?

I have a ListView that has several columns. One of them contains "Names", the other contains "Amount". I would like to allow the user to click the Names column in the listview and have it sort alphabetically and also allow the user to click the "Amount" and have it sort numerically (higher/lower - lower/higher). What is the best way...

Rules for multi-user WinForms apps on Vista

We have an MSI installer for a .Net WinForms app for Windows XP that installs and runs only as an admin. Users have to log in to the app when it runs. Customers want it to install and run under a user account under Vista, and to use their Windows account. A preliminary look through the code shows lots of problems; the installer writes t...

Design Time viewing for User Control events

I've create a WinForms control that inherits from System.Windows.Forms.UserControl...I've got some custom events on the control that I would like the consumer of my control to be able to see. I'm unable to actually get my events to show up in the Events tab of the Properties window during design time. This means the only way to assign th...

Showing a tooltip on a non-focused ToolStripItem

ToolStripItems show Active highlighting when you mouse over them, even if the form they are in is not in focus. They do not, however, show their tooltips, unless the form is focused. I have seen the ToolStrip 'click-though' hack. Anyone know how to make a ToolStripButton show its tooltip when its parent form is not in focus? Thank...

Displaying controls on an alpha-blended form

I tried the Visual C# Kicks code for an alpha-blended form. This works (as soon as I remove the TransparencyKey property); that is, I can use the W3C's PNG alpha test image and see other windows underneath, but makes all controls on the form invisible. Presumably, they simply aren't painted, as OnPaint is overridden. I tried calling the ...

What is the best method to gather data about the use of your application?

My company releases a small software product for which I've recently been taking over the development side. It is a C# Windows Forms application. One of the things I've noticed is that much of the information about how the software is used is filtered through my superiors and I get the feeling that I'm missing important detail in some ...

What is the best third-party WinForms grid for .NET?

It seems that there are many third-party .NET WinForms grids available on the market. I have seen Syncfusion, Xceed, and Infragistics in use at various companies, but now need to choose one for my own use and can't find objective information. My priorities are ease of use, hierarchical capabilities (i.e. ability to drill down on a row ...

How do I convert a .NET console application to a Winforms or WPF application

I frequently start with a simple console application to try out an idea, then create a new GUI based project and copy the code in. Is there a better way? Can I convert my existing console application easily? ...

With what GUI framework is the Mono .NET Windows.Forms implemented?

With what GUI framework is the Mono .NET Windows.Forms implemented? Example: KDE, Gnome, X11 itself? ...