winforms

Separate 'selected items' and 'focused item' in WinForms ListView

Hi, I'd like to implement a ListView that will have a list of SelectedItems as it has now, but it will also have a separate item that is under cursor (movable with mouse/keyboard). Item selecting will be done with special action (for example the space key). In other words, I'd like to suppress selection on the ListView and only change...

Windows Forms application, how to communicate between custom controls?

I have three user controls. Here are the description of them: 1) First user control(ucCountry) contains combobox which displays country names from an xml file. 2) Second user control(ucChannelType) contains two radio buttons one to select TV and other to select Radio Channel Type. 3) Third usercontrol(ucChannels) will populate all the ...

Why is there a databind() for a asp.net gridview?

Why is there a need to explicitly call GridView.DataBind() to render the gridview. Why wouldn't it render by itself automatically like how it happens in Window Forms? ...

Debugging .NET 2.0 Winforms application using Debugging Tools for Windows

I support a .NET 2.0 Winforms application that is fairly widely deployed. On rare occasion we get a support call from a customer in which the application returns a .NET runtime exception AS SOON as you attempt to launch the application. In the past we have helped the customer re-install the .net framework and very often that works...but...

how to change "this.ShowInTaskBar" for a "form.ShowDialog()" while keeping it open?

if you run this snippet of code(put it in form1) in a fresh new winform app with 2 forms private void Form1_Load(object sender, EventArgs e) { Form2 newForm = new Form2(); Button b = new Button(); newForm.Controls.Add(b); b.Click += new EventHandler(click); this.Show(); newForm.Sho...

Custom control box button

Some Windows applications add buttons to the control box, which apparently is the name for the group of minimize, maximize, and close buttons. One such application is Skype, which has a button for switching from a one-window-that-contains-everything mode to a one-window-per-conversation mode and vice versa: I'd like to know how you ca...

.NET WinForms Control class

Do all the windows and controls (including active-x) displayed inside WinForms application are derived from System.Windows.Forms.Control class? ...

How many elements of array are not null ?

An array is defined of assumed elements like I have array like String[] strArray = new String[50];. Now from 50 elements only some elements are assigned and remaining are left null then I want the number of assigned elements. Like here only 30 elements are assigned then I want that figure. ...

Extending a solution for simple binding to a 'Text property to multiple Controls to handle binding to any Type ?

My question is : how to move beyond writing a custom implementation of a technique for databinding multiple controls (controls without built-in DataSource properties), for each possible type of data, to simple properties ... as described and demonstrated in code that follows ... to achieve a more poweful solution that will be independent...

Assigning values to the datagridview cell.

How can I assign values of the textbox to the datagridview cell ? ...

Can I assign the values to datagridview cells at a time ?

Can I assign the values to datagridview cells at a time like datagridview1[0,0].value = "zero column zero row" datagridview1[1,0].value = "first column zero row" datagridview1[0,1].value = "zero column first row" datagridview1[1,1].value = "first column first row" It gives error Index was out of range. Must be non-negative and less...

Making splitter visible for Split Panel

How do I make a split panels splitter visible to the user, rather than being invisible with only a cursor change on mouse over? ...

After adding a TreeNode to the .NET TreeView, it's IsExpanded property turns false, any idea why?

I have a TreeView control on a form. I am dynamically adding new TreeNodes to it, and I am calling Expand() on them prior to adding them. This causes their IsExpanded property to be true. However immediately after adding it to the TreeView, or to any node on the TreeView, its IsExpanded property turns false and none of the nodes are expa...

Monitor keystrokes

Hi all , I am a beginner in C# , and making a calculator . But i want to disable the "GO!" button when there's no number typed in textbox1 and once the user enters a number in it the "GO!" button becomes enabled again ... how to do this in C# ? i tried KeyDown and KeyPress event like this but never worked private void Form1_Load(object...

Access a control's Text property after parent form Dispose()'d?

Long-time joelonsoftware follower, 1st-time stackoverflow poster. I want to know "how safely" I can do the following (C#): Form formDlg = new Form(); TextBox box = new TextBox(); formDlg.Controls.Add( box ); formDlg.ShowDialog(); formDlg.Dispose(); string sUserEntered = box.Text; // After parent Dispose'd! In practice, this (apparent...

WinForms + commands from console in C#

Hi, I've read a few topics about programs that combine WinForms and console applications but it seems my question hasn't been solved yet. Is it possible to run a program from cmd-line and to be able to control the app via forms and via cmd-line commands? It means: for ordinary users of the app to control the app via (win) forms, for...

Why combobox refresh doesn't work?

Hello, I have a complex problem, could you please help me. The problem: I have a form with a TabControl. There are two TabPages in the first is a dataGridView and in the second are multiple comboboxes. DataGridView is filled with data from Table1, on the other tab the first combobox datasource is set to TableCB1, the second combo...

CustomListbox control, how to make the items have a custom feel to them in C# (winforms)

So i have a listbox, and here is what im trying to acheive: have the class style adding/selecting/removing sort of like a TreeView ListBox items have more than one label docked to different sides of the space ( for example, the item would be thicker, and would be big enough for two labels on top of eachother, and then perhaps another o...

How to make a modeless form "block"?

I have an application that displays two forms/windows at the same time. The first one is shown with the Form.Show() method, so it is modeless and floats off to one side. The second form is shown with Form.ShowDialog(), so it is modal, and it blocks. The fact that it blocks is important, because unlike the first form (which is basic...

How to refresh datagridview when closing child form?

I've a dgv on my main form, there is a button that opens up another form to insert some data into the datasource bounded to the dgv. I want when child form closes the dgv auto refresh. I tried to add this in child form closing event, but it doesn't refresh: private void frmNew_FormClosing(object sender, FormClosingEventArgs e) {...