winforms

Loop through controls in TabControl

I am looking for a way to loop through controls on a particular tab of a tabcontrol. For example, I have a tabcontrol with the following tabs: Cars, Pets, Admin On each of these tabs are several controls to display/edit/save data, etc. On the "Save" button, I would like to loop through the controls for that particular tab to check wh...

Displaying design-time pop-up form for MaskedTextBox.Mask property in a run-time

Does anybody know if it's possible to open a pop-up form "Input Mask" which is displayed when you want to change Mask property of MaskedTextBox editor and you click on the details button on the right side of this property in design-time? I'd like to use the same form in run-time in an application and use its result for mask string. ...

What event to use for a TextBox control to signal text change upon pressing enter?

TextChanged sends a notification for every key press inside the TextBox control. Should I be using KeyDown event? ...

Is it possible to use theme colors in Windows Forms apps?

I normally make use of System Colors whenever possible when designing Windows Forms applications just so that it'll fit in with the user's preferences. But is it possible to use Theme Colors? I realize that this limits you in several ways (must be running Windows that supports it and has the Themes service running), so I would certainl...

Disable Cell Highlighting in a datagridview

How to disable Cell Highlighting in a datagridview, Highlighting should not happen even if I click on the cell. Any thoughts please ...

Use instance or form name when addressing public variables between forms?

In vb.net, you can address a public variable from another form using the form name along with the variable. form2.show form2.k = 3 However, if you use a form variable to show an instance of the form, you must use that variable name to address the public variable. Two instances of the same form are displayed in the following example. T...

How do I print a displayed form in my Winforms application?

what is the code in C# for printing a form in the application? ...

Cell selection in continuously updated DataGridView

I have a DataGridView in virtual mode that gets continuously updated by inserting rows at the top of the grid, so that rows appear to "flow down". When the grid is not updated, cell selection behaviour is as expected: mouse drag selection results in contiguous rectangular selection region. When the grid gets continuous updates, the sel...

Application 'Deactivate' event

I'm looking for something similar with 'Form.Deactivate' event but per application. If I use Form.Deactivate event on my MainForm this event is fired even when I open a modal dialog that has as parent my MainForm. In conclusion I nedd an event that is fired when my application was deactivated. ...

Why is this winform becoming unresponsive?

Hello, user selects an image (using fileOpenDialog) then I need to run 3 algorithms sequentially (output of one algo becomes input of another) on this image. so, I'm using background worker for running these algorithms. After each stage I want to see the result image. For this I created a ImageViewer class, which is just a simple form ...

Hierarchical object retrieve childsIds with linq

How can I do this in one linq statement: If got an list of objects where I have (id, name, parentId). Now I have 3 levels of hierarchy in this list. What I want is that when I'm getting the Id of the top level in my function, I want the Ids of the 3th level. I've got this for the moment: Public List<int> GetIds(int objectId){ var id...

How might I change the Form loading at start-up to another form?

By default when I run my project, it loads form1, but I want to change it such that when it loads the Project it opens form2 instead. How could I accomplish this? ...

Windows forms window starting up out of focus (and behind executable folder)

Hi, I'm getting some strange behaviour in the start-up of a Windows app and wondered if anyone could throw any light on what is happening and how to get around it. The problem is with the start-up of the app - it should show a splash screen then a login form. The code for this is: [STAThread] static void Main() { A...

Howto save a password in the registry

I have a desktop application with a remote interface. The access to the remote interface is secured by a username and password. What would be the best way to save these password securely, preferably in the registry? ...

Is this a right case for using the Threadpool?

Here's the setup: I'm trying to make a relatively simple Winforms app, a feed reader using the FeedDotNet library. The question I have is about using the threadpool. Since FeedDotNet is making synchronous HttpWebRequests, it is blocking the GUI thread. So the best thing seemed like putting the synchronous call on a ThreadPool thread, and...

Getting blank rows after setting DataGridView.DataSource. How to solve this problem?

Hello, Could somebody tell me why I'm getting blank rows after runnign this code?? ... dataGridView.AutoGenerateColumns = false; //must be false, else getting additional coulumns from sql. dataGridView.DataSource = dataSet.Tables[0].DefaultView; Also tried dataGridView.Update(); but not working. Row count is ok, but why blank ro...

How to access controls on an inherited form?

Hi, I'm using the DockPanel Suite in my winforms app. The DockContent class is derived from System.Windows.Forms.Form class and my two forms, dockRounds and dockToolbox, inherit from the DockContent class. This is the first time I've done this and this is probably a stupid question, but in runtime, how do I access the controls of the d...

Preserve DataGridViewRow.Tag property in databound DGV when sorting data

Is there a way to keep the tags from being nulled as soon as I sort the grid? If not, is the Tag property actually useful for anything except non-databound usage? ...

HostingProcess.ParkingWindow error in simple app

In the static void Main() of my winforms app I get the following exception: "Unable to cast object of type 'Microsoft.VisualStudio.HostingProcess.ParkingWindow' to type 'CSVImport.frmImport'." This happened afte moving some functionality out to a public class. I build to framework 3.5. Here is the kicker: When I start the app...

Accessing GPS Data From a .Net Winform Application

Does anyone out there have any experience programatically retreiving the lat/long from a GPS attached to a mobile PC? A team I'm on is currently looking at hardware options--as the programmer who will eventually have to live with whatever is selected I was wondering if anyone out there has had experience writing .Net programs that inter...