Hi, I am using Windows Forms. I wish to put ComboBoxCell for particular cells only. Is it possible ?
I tried by the following way
Error :- InvalidOperationException was unhandled - "Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function"
Suggestions will be much helpful !
Thanks Again !
I tried by the following way
C#:
private void MyDataGrid1_CellEnter(object Sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == 4)
{
if (e.ColumIndex >= 2 && e.ColumnIndex <= 7)
{
DataGridViewComboBoxCell ImSubHdCell = new DataGridViewComboBoxCell();
ImSubHdCell.FlatStyle = FlatStyle.Popup;
ImSubHdCell.Items.Clear();
ImSubHdCell.Items.Add("MyValue1");
ImSubHdCell.Items.Add("MyValue2");
ImSubHdCell.Items.Add("MyValue3");
myDataGrid1[e.ColumnIndex, 4] = ImSubHdCell;
}
}
}
private void MyDataGrid1_CellLeave(object Sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == 4)
{
if (e.ColumIndex >= 2 && e.ColumnIndex <= 7)
{
DataGridViewTextBoxCell ImTxtBxCell = new DataGridViewTextBoxCell();
myDataGrid1[e.ColumnIndex, 4] = ImTxtBxCell;
}
}
}
Suggestions will be much helpful !
Thanks Again !