winforms

Keep row of datagridview clicked by user selected

Hi All, I need the snippet code in C# to mantain selected the row from a DataGridView after that row is double clicked. Right now I'm displaying data from a dataset and the selection mode is FullRowSelect. Any way to set this? There are two scenarios to deal with: Everytime the timer ticks the selected row always go to the first r...

Cascade the MDI forms of a Splitter panel

I am showing my MDI windows inside the main form but in one part of the splitter panel, like this: Form2 f2= new Form2(); f2.MdiParent = this; f2.Parent = this.splitContainer2.Panel2; f2.Show(); but the problem is that I cannot cascade them if I write a code like this: this.LayoutMdi(System.Windows.Forms.MdiLayout.Cas...

Capture keystrokes (e.g., function keys) while a messagebox is up

We have a large WinForms app, and there is a built-in bug reporting system that can be activated during testing via the F5 Key. I am capturing the F5 key with .Net's PreFilterMessage system. This works fine on the main forms, modal dialog boxes, etc. Unfortunately, the program also displays windows messageboxes when it needs to. When th...

Updating ToolStripProgressBar and ToolStripStatusLabel along with with an action

In a Windows Form, I have a search box that fires an event to search a remote database and display some results. The query is pretty fast, usually just a fraction of a second, but in case the delay is noticeable there is a progress bar and label in the form's status bar. When the user clicks "Search" the status label should appear and th...

"x" To Minimize WinForm, ContextMenu To Close WinForm?

Hi SO, I have a WinForm that I want to minimize when the "x" in the top right corner is clicked. To accomplish this, I have: private void Form_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; WindowState = FormWindowState.Minimized; } That's all well and good, but now I have a context...

Making WinForm ContextMenu Background Gray?

Context menus seem to have a default white background. This looks pretty nice, but for consistency's sake, I'd like the context menu to be gray like with any other application. How can I get this style for my context menu? ...

Is there a way through the Visual Studio IDE to move buttons between ToolStrips?

I have multiple ToolStrips with buttons on my form. I'd like to move some buttons from one ToolStrip to another. However, the Visual Studio IDE is not allowing me to drag the buttons off of a ToolStrip. I could go and edit the designer file for the form, but I try to avoid that as much as possible. So is there some way to do this through...

ContextMenuStrip Is Available On NotifyIcon, But Not ContextMenu?

I'm adding a ContextMenu to a WinForm application and I want to associate it to a NotifyIcon. The issue is the NotifyIcon's properties only include ContextMenuStrip and not ContextMenu. How can I add a ContextMenu to my icon? Thanks! ...

Using SQL Server Database View for populating DataGridView and modifying data in DB

Using SQL Server Database View for populating DataGridView and modifying data in DB I want to know that how this will be done and if this is not a good solution, then please elaborate if any other good solution is possible. 1) Initially I want to use a Database View for populating different DataGridViews. 2) Multiple joins from mult...

How to display scrollbar inside of treeview control

I have many nodes and some of them are under the screen's edge. Tho treeview is scrollable, there is no vertical scrollbar on the right. How can i show it? ...

Three State Treeview Windows Forms

Hello everybody people, One of the frustrations with the standard TreeView is that you can't show a partial selection to indicate that some of the children are selected. A partial selection in a complex tree allows the user to easily determine where the selections are, even if the tree is not completely expanded. A similar idea is use...

How can I insert an ironpython console into my form?

I want to make a winform by C#, and add a ironpython console window in it, like a multiline textbox. So I can write python program into it to do some operations in my Winform software. How can I do that? Thanks. affixture: I created a opensource project IpyIF, Ironpython Interactive Window.http://ipyiw.codeplex.com/ ...

Organising UI code in .NET forms

Hi I'm someone who has taught myself programming, and haven't had any formal training in .NET programming. A while back, I started C# in order to develop a GUI program to control sensors, and the project has blossomed. I was just wondering how best to organise the code, particularly UI code, in my forms. My forms currently are a mess,...

datagridview rowsremoved event gets called every time data loads

The datagridview rowsremoved event gets called every time the data gets loaded. It also makes sense to a certain extent that every time the data loads, the existing rows are removed. so technically the event should get called. But how do i differenciate that from the actual delete button getting pressed. I don't think the key events sho...

Dynamically setting alignment of cells of gridview

Hi, In my gridview i have 3 6 columns. by default i am setting dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; this.dgv_folderContents.RowsDefaultCellStyle = dataGridViewCellStyle3; So all cell values are displayed with left align. But there are two column checkbox and image I wan...

Refresh databases data

How can i refresh the data from my database(ms access) in c# using windows form aplication? part of the code where i insert the data : insertCommand.Parameters.Add("@ID_uporabnika", OleDbType.Integer).Value = Convert.ToInt32(textBox6.Text); insertCommand.Parameters.Add("@datum", OleDbType.DBDate).Value = DateTime.Now.ToShortDateString()...

How to refresh screen so that closed forms actually disappear

I have multiple forms that popup during an intensive operation. For example, when a form popups asking user for something, and the user clicks OK, the form's graphics stay on the main screen, even though it is closed. How can I make it so that these graphics disappear completely? ...

Background Worker Check For When It's Midnight?

I want to create a background worker for a WinForm that triggers code whenever midnight rolls by. I have an idea of how to do it, but I'm pretty sure it's not the best way to do it. while(1==1) { //if Datetime.Now == midnight, execute code //sleep(1second) } ...

Splash screen moves up before closing

In C# I am having a problem with the splash screen. When it is time to close and the main Form1 appears, it moves over to the upper right corner of Form1. It then disappears. I have never had this occur before and have just about run out of ideas to fix it. I want the splash screen to disappear in the center screen and not move over ...

What do C# Table Adapters actually return?

Hello, stack overflow ! I'm working on an application that manipulates SQL tables in a windows form application. Up until now, I've only been using the pre-generated Fill queries, and self-made update and delete queries (which return nothing). I am interested in storing the value of a single value from a single column (an 'nchar(15)' n...