As the title said I have a datagridview with combo box(s) I want to populate each combobox in each row alone for example in the first row in the first combobox I select a something based on the selection the second combobox in the same row populated with specific data and when select a choice from the second combobox the third combobox populated with specific data and so on

Click Here
Click Here

As you can see in the images I posted above in the links see both images they demonstrate what I meant.

Each combo box will have a selectedIndexChanged event which you can use to catch the selected option and then respond appropriately, in your case populating the second combobox based on the selection in the first. Does that make sense?

I used to populate the comboxbox with data that way
1- using the cell end edit event and
2- if the cell is not empty, take its value and execute a query based on that value that returns me data within a datatable
3- Using foreach on each data row within the datatable to add items to the data grid view combo box. As such code snippet

DataGridViewComboboxColumn dgvcmbx = New DataGridViewComboboxColumn();
foreach(DataRow dtRow in dtbl.Rows)

But the problem is that suppose I did that on the first row and I select a value on the first combo box and it works fine and data populated in the second combox box when I select another value on the first combo box on another row there will be and error as the combox box will be populated with some new data that do not include the piece of data I already select on the second combo box of the first row.

This article has been dead for over six months. Start a new discussion instead.