What I would like to do is if the combo box is changed to a certain value,
change the value of another cell in the same current row. What I have so far
is some code in the CurrentCellDirtyStateChanged event. This works, but the
event only fires when the cell with combobox is exited.
Is there a way to do this without leaving the combobox cell?
(So far every method I've tried has required leaving the cell and/or row.)
Can you please try the following code. Let me if its working you.
COLUMN_COMBO_SELECTION = your combo column id
private void dataGridView_CurrentCellDirtyStateChanged(object sender,
EventArgs e)
{
if( this.dataGridView.CurrentCell.ColumnIndex == COLUMN_COMBO_SELECTION) {
this.dataGridView.EndEdit();
}
private void dataGridView_CellValueChanged(object sender,
DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1 && e.ColumnIndex == COLUMN_COMBO_SELECTION)
{
string comboText = this.dataGridView.CurrentCell.Value.ToString();
switch (comboText)
{
case "Text1":
this.dataGridView[COLUMN_NEXT, e.RowIndex].Value = "Default Text";
break;
}
}
Thanks
Jibesh
"B. Chernick" <BChe...@discussions.microsoft.com> wrote in message
news:47A9A668-15A4-4946...@microsoft.com...