winforms

How to make context menu as non selectable when the usercontrol is active

I am having a context menu displayed when i right click on a node of a treeview. Suppose my treeview is as follows Root |->some.txt |-> Child(For some.txt) |-> Child1(child for Child) If i right click on Child1 i will have an option as AddNew. If the user selects i will show a user control form for the user display...

WinForms Remote Data Access

VS2010: What is the best way to access a remote database over the internet from a WinForms application? By that I don't mean talking to the database (SQL Server) directly, but rather through a service. Best if I could use http as a protocol to avoid firewall issues. ...

Values of the UI controls not being set at runtime

I have a base class library which contains all the UI controls with extended capabilities. Ex: XTextBox <---derived from------ TextBox XPanel <---derived from------ Panel XLabel <---derived from------ Label I use this library in my client application for rendering the controls on the UI. I have an AppConfig file which det...

Hooking into Forms redrawing

I'm looking for a way to overlay the graphical output of a third-party application with some lines, arcs etc. The applications accepts a handle of a window in which it will then display its output. Using VC++ I put together a Windows Forms app in Visual Studio that draws (non-static) stuff in the onPaint-method of a form. Passing this f...

Windows forms spinning in c#.

I have two windows forms.Now I have to close first one and show the second form and vice-versa.How can i do it.I was passing this pointer to the constructor of second form and then trying to close it,but this did not work.I can not use showdialog here. ...

Which CheckedListBox event triggers after a item is checked?

I have a CheckedListBox where I want an event after an item is checked so that I can use CheckedItems with the new state. Since ItemChecked is fired before CheckedItems is updated it won't work out of the box. What kind of method or event can I use to be notified when the CheckedItems is updated? ...

Get selected RadioButton inside a group

I have a winforms app with a group box called priceClassGroupBox. Inside it I dynamically add RadioButtons to which I give a name, say radio1, radio2, radio3. I have 2 questions: Can I automatically select a given RadioButton by it's name without iterating through each control? Can I get the name of the selected RadioButton without i...

Sorting a list of items in a list box

I want to get an bunch of items from a list box, add them to an array, sort it, then put it back into a different listbox. Here is what I have came up with: ArrayList q = new ArrayList(); foreach (object o in listBox4.Items) q.Add(o); q.Sort(); listBox5.Items.Add(q.ToString()); But it doesnt work. A...

Line seperation / Line break in a listbox

I want to display 2 sets of data on the one list box, for example, I would wont to display the 7 times table and the 8 times table on the same listbox. Here is how I get the first set of data displaying: int awnser = 0; int z; z = int.Parse(textBox1.Text); for (int i = 0; i < 11; i++) { ...

Cross thread operation on WinForm controls

Here is my code scenario, In main thread I create panel(s) (based on some configuration), and then in the next step based on the file type (like video, ppt, image...) I create appropriate controls (dynamically) to show on the forms. The creation of the control will be done in separate threads (for each file). After creating the control...

[WinForms] ListView - how to change space between text and cell boundry?

Hi, I've got listView in DetailView and I need to minimize columns width, so all data can fill in specific screen resolution (my client really want to avoid scroll bar). When I set width under specific value, it cut my text in spite of that there is still space for value in that cell. I guessed that there's is property to set it properly...

time portion from datetime value in LINQ

I have field which is of type DateTime. When inserting a record, I am also providing the time into the field. When reading that field with LINQ, it will return me the correct date but the time values has the default, 12:00:00 AM In the database, I have values with date and time for each record which is correct. The problem is that the...

How to easily find screen location of form Location in multi-monitor environment?

In a C# winform application running in a multimonitor environment (desktop is stretched across 2 or 3 monitors), the Location property of a Form represents the location of the form on the spanned desktop instead of the location of the form on the physical screen. Is there an easy way to find the Location of the form in screen coordinate...

How do I edit the name of an item in a CheckedListBox?

I have a CheckedListBox that has X number of items. These items are placed there at runtime. These items are supposed to represent reports that can be displayed in the DataGridView. What I need to do now is display the record count for each report in parenthesis right next to the report name. I tried, not for too long, to edit the ac...

XWindows terminal emulation as a .NET Winform component

We are writing a kind of industry dashboard that shows many graphical information coming from various sources. Because one of these sources is a closed Unix application, we would need a XWindow terminal emulator which works as a Winform control. Has somebody already used such a control, if it exists ? Thanks a lot ...

Why should I do manual double buffering? (C#)

I am working on a game in C# (either 2.0 or 3.5 havn't decided yet). The game will be played on a map with a hexagonal grid. I appreciate that the UI for this map should use double buffering (lots of layers, so slow drawing). I know that I can enable double buffering through a style, or create my own buffer and handle it myself. Most...

Can PropertyGrid edit any old list of key-value pairs?

All PropertyGrid examples I have seen allow the user to edit a single object, which PropertyGrid scans by reflection. I would like the user to be able to edit, for example, an ini file or a plain-old Dictionary, with one line per key-value pair. Is this possible? ...

Two way binding with UI quirks

I haven't really done a two way binding project before, so this might be a simple question. I have an business object with all the right interfaces (INotifyPropertyChanged, etc...). I bound a Int32 property called CPP to a textbox named txtCPP via a BindingSource. The rules state that if CPP is less than 0, the text box should be blan...

Windows.Forms.ListView - Multiple selection in different groups

I have a ListView control with grouped items in it. My goal is to enable multiple selection only inside one group - the user should not be able to select any items except from those from the current group. My first thought is on canceling some event (something that happens before the item is selected), but I can't find the right one. T...

Loading Windows form with over 200 controls

My form has over 200 control(s)! It takes about 7 seconds to load the form and bind the controls. I've traced the application with some performance profilers , but I didn't find anything with HOT flag except the constructor's of form. I would like to know that is it possible to call InitializeComponent method with sth like backgroundWo...