|
-
May 16th, 2007, 02:00 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2.0] DataGridViewComboBoxColumn "Events"
Hi,
Would sb know how to capture a "Selected Item Change", from DataGridViewComboBoxColumn. (This would be a DataGrid Column, with a combo box format. (winforms)).
Thanks.
-
May 16th, 2007, 02:14 AM
#2
Re: [2.0] DataGridViewComboBoxColumn "Events"
 Originally Posted by Rauland
This would be a DataGrid Column, with a combo box format.
It would actually be a DataGridView column. A DataGrid is not the same thing as a DataGridView.
The column has no event for a selection change because the column may contain hundreds or even thousands of cells. Each of those cells will contain a ComboBox control if and when it is being edited. Different cells may use the same or different ComboBox controls at different times. This is how the DataGridView works. It creates a control of the appropriate type when a cell needs to be edited. It also reuses the same control in different cells to increase efficiency.
So, what do you do? You handle the EditingControlShowing event, at which point you know a control has been created for editing a cell. You can check whether the e.Control property refers to a ComboBox control and, if it does, attach a handler to its SelectionChangeCommitted or SelectedIndexChanged event. Just note that making a selection in a combo box cell does not change the value in that cell until the editing session is ended, which basically means when the user moves to another cell.
-
Jun 12th, 2007, 02:44 AM
#3
Thread Starter
Hyperactive Member
Re: [2.0] DataGridViewComboBoxColumn "Events"
Thanks Jmcilhinney, wouldn´t of solved my prob without your help.
I also found this link, other people might find it useful to.
http://forums.microsoft.com/msdn/sho...12780&siteid=1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|