Saturday, May 9, 2009

Getting the Selected Value of Combo Box in DataGridView

In following example I am try to get the Selected value of Combo Box which is in DataGridView.
Create a Windows Applicaiton and Add a DataGridView in the Form1

We need to initialise DataGridViewEditingControlShowingEventHandler of DataGridView to handle its control events, so please use follwoing code in Forms Constructor

image

In the form load we will fetch all the data and assign to DataGridView

image

Now catch the control edit event in the DataGridView and assign the SelectIndexChanged event to each Combo Box in DataGridView

image

Add Follwoing Combo Box's SelectedIndexChanged which we assigned to all the combo boxes in DataGridView

image

Now we are ready with our code lets build, run and test.

Output:

image

Tags: Getting the Selected Value of Combo Box in DataGridView, DataGridView

No comments:

Post a Comment