Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > ComboBox In DataGridView Event. SelectedIndexChange
 

ComboBox In DataGridView Event. SelectedIndexChange

Hi,

I have got a DataGridView and It has a ComboBox which has some records but I couldn't access the selectedIndexChanged event.
I tried to check on windowforms and I did find the code but in C# and somehow when i'm trying to change it to VB its not working.

Can someone please look at it.

Here is the link for the code:

http://www.windowsforms.net/FAQs/default.aspx?PageID=2&ItemID=691&CategoryID=3&tabindex=3

Or here is the code:

Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing

ComboBox cb = e.Control as ComboBox;

if (cb != null)

{ // first remove event handler to keep from attaching multiple: cb.SelectedIndexChanged -= new EventHandler(cb_SelectedIndexChanged);

// now attach the event handler cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);

} } void cb_SelectedIndexChanged(object sender, EventArgs e) { MessageBox.Show("Selected index changed");

End Sub

Thanks

Prince of Dhump  Friday, January 26, 2007 4:49 PM
Look here.
vkh75  Saturday, January 27, 2007 10:04 AM
Look here.
vkh75  Saturday, January 27, 2007 10:04 AM

You can use google to search for other answers

Custom Search

More Threads

• edit wrong rows after sorting
• I am having update trouble
• data binding to a photo with sql server 2000 in c#
• How do I change datagridview datasource and refresh screen
• radio buttons in winforms
• accessing controls
• Filtering a BindingSource
• Refreshing a the SelectedValue's DisplayMember in a databound combobox
• Is it possible to add a checkbox for every column???
• DataBase .gdb