DataGridViewComboBoxCell selected index
I have a datagridview that the user can add and delete rows from. one of the columns is a DataGridViewComboBoxColumn. i want to be able to loop through each row in the grid and get the selected index of the combo box for that row. i've tried everything i can think off but can't get it to work. could anyone help me?
something like this:
Code:
for (int i = 0; i < DataGridView.Rows.Count; i++)
{
MessageBox.Show(DataGridView.Rows[i].Cells["ComboBoxColumn"].SelectedIndex.ToString();
}
but obviously this doesn't work because it returns the value of the cell rather than the actual combo box
Re: DataGridViewComboBoxCell selected index
I assumed that you bind the ComboBox column to the data source. If yes, ValueMember property of the column should return value of the selected item in the combobox.
www.madartsoft.com C# controls, Help Desk Software
Re: DataGridViewComboBoxCell selected index