how to get selectedindex chaned event in datagridviewcombobox column in C#.net.
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
int rowIndex = dataGridView1.CurrentCell.RowIndex;
uid = Convert.ToInt32(dataGridView1.Rows[rowIndex].Cells["UserID"].Value.ToString());
if (dataGridView1.CurrentCell.ColumnIndex == 1 && e.Control is ComboBox)
{
ComboBox comboBox = e.Control as ComboBox;
comboBox.SelectedIndexChanged += LastColumnComboSelectionChanged;
}
}
private void LastColumnComboSelectionChanged(object sender, EventArgs e)
{
var currentcell = dataGridView1.CurrentCellAddress;
var sendingCB = sender as DataGridViewComboBoxEditingControl;
DataGridViewTextBoxCell cel = (DataGridViewTextBoxCell)dataGridView1.Rows[currentcell.Y].Cells[0];
cel.Value = sendingCB.EditingControlFormattedValue.ToString();
UpdateQuery up = new UpdateQuery();
up.updateaccesspermission(uid,cel.Value.ToString());
}i uses the above code..it shows an error