winforms

Get most recently selected item (WinForms)

Scenario: Windows Form Listbox SelectionMode = MultiSimple Items 1 and 5 are selected already User selects item 3 by clicking on it or by pressing the spacebar after it has focus Q: How do I get its index or value on SelectionChanged? I.e., how do I know which item was just selected (or de-selected)? FYI, SelectedItem will return ite...

PowerBuilder 11.5 WINFORMS question regarding event handling...

Hi all, I'm having an issue I'd like so get some feedback on. I'm not going to detail the exact issue about how my application functions as it really doesn't matter in this case. I'm using PB 11.5 and have been tasked with converting a Win32 app to WINFORMS. Suppose I didn't like the look of the PB command buttons and wanted to create...

how to connect multiple tables and populate into a datagridview control ?

how to connect multiple tables and populate into a datagridview control ? What i can think is create a view, but if there any other better resolutions ? ...

Winforms application hangs when switching to another app

Hi, I believe I have a potential threading issue. I have a user control that contains the following code: private void btnVerify_Click(object sender, EventArgs e) { if (!backgroundWorkerVerify.IsBusy) { backgroundWorkerVerify.RunWorkerAsync(); } } private void backgroundWorkerVerify_DoW...

How to maintain ComboBox.SelectedItem reference when DataSource is resorted?

This really seems like a bug to me, but perhaps some databinding gurus can enlighten me? (My WinForms databinding knowledge is quite limited.) I have a ComboBox bound to a sorted DataView. When the properties of the items in the DataView change such that items are resorted, the SelectedItem in my ComboBox does not keep in-sync. It seems...

ProcessCmdKey - wait for KeyUp?

Hi, I'm having the following issue in a WinForms app. I'm trying to implement Hotkeys and I need to process Key messages whenever the control is active, no matter if the focus is on a textbox within that control, etc. Overriding ProcessCmdKey works beautifully for this and does exactly what I want with one exception: If a user pr...

How can I tell when the Text of a System.Windows.Forms.GroupBox wraps to the next line?

I'm creating a GroupBox at runtime and setting its Text property. Usually, the text is only on one line, but sometimes it wraps. The problem is that the controls contained in the GroupBox cover up the GroupBox's text. What I'd like to do is determine if and when the text wraps. Specifically, I'd like to determine how much extra height t...

C# - How can i open a second winform asynchronously but still behave as a child to the parent form?

I am creating an application and i would like to implement a progress window that appears when a lengthy process is taking place. I've created a standard windows form project to which i've created my app using the default form. I've also created a new form to use as a progress window. The problem arises when i open the progress window ...

Databind List Of Objects To A WinForms DataGridView, But Not Show Certain Public Properties

I'm not even sure if i'm doing this correctly. But basically I have a list of objects that are built out of a class. From there, I am binding the list to a datagrid view that is on a Windows Form (C#) From there, it shows all the public properties of the object, in the datagrid view. However there is some properties that i still need ac...

Why does the interpreted order seem different from what I expect?

I have a problem that I have not faced before: It seems that the order of interpretation in my program is somehow different from what I expect. I have written a small Twitter client. It takes a few seconds for my program to actually post a tweet after I click the "GO" button (which can also be activated by hitting ENTER on the keyboard)...

how to bind a winforms to a field ?

I use winforms to develop application, I want to know how can I use data binding to bind two radio button to a database field ? And if bind to a database field is too complicated, then can I save the value manually while leave other field bind to textbox and automatically update the value? ...

WinForms ListBox with readonly/disabled items

Is there a way to make some of the items in a ListBox readonly/disabled so they can't be selected? Or are there any similar controls to ListBox to provide this functionality? ...

IHierarchyData and IHierarchicalEnumerable in Winforms

Hi! Currently,I know how to do a lazy implementation of the loading procedure of the nodes in a treeview control, and read the related questions in stackoverflow, but I'm also reading about IHierarchyData and IHierarchicalEnumerable interfaces in asp.net (I didn't know to code asp.net) that allow to bind a collection to a treeview in o...

Move controls when Drag and drop on panel in C#

I want to drag controls on panel and when dragging I want to move the control and get its location to drop on to panel.I have tried out mouseUp,mouseDown,MouseMove events of control.But that is not what I am looking for.I want to fire DragDrop event on panel and move control.Can I do this?If you can give me an idea it will be great.Below...

How can I set the scroll area and origin on a UserControl with AutoScroll ?

:) My question is quite a mouthful. This is a WinForms question : I'm making a UserControl where the mouse wheel is used for zooming and the content would be drawn using GDI+. After I activate AutoScroll, how can I set the area size and origin of the scroll view ? Thank in advance for any help. ...

Optimizing Smart Client Performance

I have a smart client (WPF) that makes calls to the server va services (WCF). The screen I am working on holds a list of objects that it loads when the constructor is called. I am able to add, edit and delete records in the list. Typically what I am doing is after every add or delete I am reloading the entire model from the service aga...

vb.net add text to form without interaction

I have a winform project which lists all the files in a specified folder. It allows the user to select a new destination for each file, and when the user has chosen the destinations for all files that he would like to be moved, it moves the files, one by one. My next step is, I need to display a confirm form when the files are being mov...

.NET Month Picker Control

Hi all, Is there a winforms month-only picker control? I need to allow the user to select the month regardless of the day of the month. Thanks. ...

what database should i choose ?

I use winforms to develop a desktop application, and right now I plan to use SQL server express, but the problem is, if i use sql server express, then the installation is much trouble, i need to install sql server first, and install my own applicaiton. Then I tried to use access 2003 as my database, then I only need to copy the mdb file...

how can i enable user to draw line on the form in a WinForms application?

how can i enable user to draw line in the form in c# user draw with left mouse button and earse the line if he draw with the right mouse button ...