i created usercontrol ( textbox and Combobox) and added to datagridview first row ,
if i clicked in Combobox cell 0 then go to cell 1 then comeback to cell 0
the datagridview.currentcell.columnindex stayed in cell 1
i mean the cellclick fires only first time clicking the cell . if i clicked again to change the value of combobox it not fire again !!
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e){ Type CurrentCellDataType = dataGridView1.Columns[e.ColumnIndex].ValueType;
if (e.RowIndex == 0)
{
if ((CurrentCellDataType.Name != "DateTime" &&
CurrentCellDataType.Name != "DateTime2" &&
CurrentCellDataType.Name != "Date"))
{
txbComboControl = new TextWithComboControl();
txbComboControl.RightToLeft = this.RightToLeft;
txbComboControl.Visible = false;
dataGridView1.Controls.Add(txbComboControl);
txbComboControl.textbox1.KeyPress += new KeyPressEventHandler(txbComboControl_OnKeyPress);
Rectangle rect = this.dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
txbComboControl.Location = rect.Location;
txbComboControl.Size = rect.Size;
txbComboControl.FilterText = this.dataGridView1.CurrentCell.Value.ToString();
if (OperationValue != "")
txbComboControl.SelectedOperation = OperationValue;
txbComboControl.renderControl();
txbComboControl.Visible = true;
txbComboControl.textbox1.TextChanged += new EventHandler(txbComboControl_OnTextChange);
txbComboControl.OperationBox.SelectedValueChanged += new EventHandler(txbComboControl_OnCmboTextChange);
}
}