winforms

.NET TextBox - Handling the Enter Key

What is definitively the best way of performing an action based on the user's input of the Enter key (Keys.Enter) in a .NET TextBox, assuming ownership of the key input that leads to suppression of the Enter key to the TextBox itself (e.Handled = true)? Assume for the purposes of this question that the desired behavior is not to depress...

TabStop Not Working

I have a WinForm with 3 group boxes, one with combo boxes, and two with radio buttons. I set all of them and their children controls to "TabStop = false", but when I cycle with TAB, the currently selected radio button in each of the last two group boxes gets focused. If there's no way to change this behavior, what would be a good event ...

PropertyGrid alternatives

I love PropertyGrid, well, at least the concept behind it - use reflection and attributes to edit your objects without writing much UI code. My excitement died out pretty quickly though, the default PropertyGrid shipping with WinForms flat-out sucks. Well, it's fine for editing simple objects and such, but that's as far as it goes. It...

ShowDialog() doesn't bring form to top when owner is minimized

ShowDialog() doesn't bring form to top when the owner is minimized. It is shown and visible, but it is not focused and behind the current window. Even using the commented lines, I see the issue. public void Form1_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; // this.Hide(); ...

Panel not getting focus

Hello there, I am continuing to program some kind of keyboard navigation in my simple graphic program (using C#). And I ran into trouble once again. My problem is that I want to process the keyboard input to move a layer around. Moving the layer with the mouse already works quite well, yet the control doesn't get the focus (neither K...

Requirements for running a Winforms app

Hi everyone, I'm an ASP.NET developer that has never done Winforms/WPF, but I need to create a calculator application that needs to run on ANY Windows platform since Winows XP. The app will go out to a number of people and we have no idea what version of Windows they're running. So my question is, what technology should I use to ensur...

Checkbox array in C sharp

Im trying to create a array of Checkboxes in Winforms and I have four Checkboxes and if I click on a Checkbox, a messagebox should display the checkboxes checked. public void checkboxtest() { CheckBox[] boxes = new CheckBox[4]; boxes[0] = checkBox1; boxes[1] = checkBox2; boxes[2] = checkBox3; ...

How to let Windows form EXIT to system tray?

I mean exit to system tray, not minimize to system tray, ie when you click on the "red cross" in the top right corner on a Windows form, instead of application closing, it runs in the system tray instead. ...

ASP.net multiple forms

You can only have one form runat="server" per page apparently. My page has one form, where it loads in a list of names. This form allows you to add a new name to the list as well. I've attatched an onclick evevent to each name in the listview, when you click on it I need it needs to load the data into the edit form (next to the add fo...

How to create a System.Web.UI.Page object in a winform application?

I have a class which inherits from the System.Web.UI.Page class, like mysystem. When I try to create an instance of mysystem in a winform appplication it throws an HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make su...

Run WPF Application from a Windows Form

I have a problem with a solution that I'm trying to develope. This is my scenario: I have a VB6 application and I would call from this application some WPF windows. I've used the Interop Form Library to define a WinForm like a bridge from VB6 to WPF. The Interop WinForm exposes the methods to start and shutdown the wpf application. To d...

WPF windows forms host keyboard events

This is probably a simple question but i've been unable to find a quick answer. I have a WPF application which has a Windows Forms Control hosting a GeckoFX component (doesn't really matter). What i want to do is capture key down events inside the Windows Forms Control and grab focus of a WPF control for some particular key combination...

.net DrawString / StringFormat problem

Hi, I'm developing a .net 3.5 Win Forms program and I've run into an "interesting" problem with text drawing. I'm implementing a text editing control and it draws text with DrawString() and StringFormat.GenericTypographic (henceforth, GT). As the user types, whole words (or groups of words) earlier in the line are moving subtly left an...

C# Winforms Threading: Closed Form Gets Invoked

The following code demonstrates my dilemma. The code creates a background thread which processes something, then Invokes the UI thread with the result. It may throw an exception if the background thread calls Invoke on the form after the form has closed. It checks IsHandleCreated before calling Invoke, but the form might close after the...

Using + (plus) and - (minus) keyboard keys as incrementors and decrementors in a DataGridView

Hello, On a WinForms application that I am writing in C#, I have a DataGridViewTextBoxColumn with cells holding integer values that I would like the users to be able to increment or decrement using the + and - keys from their keyboards. I've handled the KeyDown event as it is what I use usually to handle Delete keys, etc, but it isn't ...

ComboBox will not update its display list unless you change selections first.

Update: I checked the answer before I fully tested it still does not work. I updated the code below so you should just be able to paste in in to a empty winforms project and it should compile. UPDATE: I have found that if I change the selected item on the ComboBox to any other item it now behaves as expected (in my code below I would sw...

C# Networking TCP/IP?

Hi All I am in need of some websites where I can buy C# WinForms networking libraries/components/dll's from. Can anybody please suggest any? They should be pretty cheap, but any and all links are welcome :) I can only find one website, and I don't like the look of what they have. Thank you ...

Threads in Web Application ASP.NET

Hi Guys, I want to use threads in ASP.NET web application. Is it possible to use threads like we use in windows forms application? or what would be the best approach to handle different tasks on the same page which are very time consuming and all the task are inter dependent at the one point. Thanks in advance. ...

How can I limit the DateTimePicker to only change the date, not the time?

Here's the situation: I have two DateTimePicker controls for the start date and end date in a log viewer. I want the start date to be whatever the user picks, but with a time of 00:00:00. The end time to be the date the user picks, but a time of 23:59:59.999. (I'll also be writing code the ensure the end date is equal to or greater t...

Using the HelpProvider class to show help, UI is always behind help window

I have a C# Winforms app that uses the HelpProvider class. Whenever i press F1 to bring up help, the help window will always be on top of my application, I cannot bring my application UI to the foreground. I can still interact with my UI, but the help window will remain on top. Is this by design of HelpProvider? Or am I missing somethin...