how to programmatically change a a cell from a datagridview combobox to textbox?
Hey guys, as usual me with questions, right now im trying to change a cell from a datagridview it is currently combobox so i want to change it to textbox if right after the person in combobox selects a specific index, however i cant access its index but only its value property, maybe i need to typecast it somehow?
Anyways if i use this code in end edit event of that datagridview
Code:
if (e.ColumnIndex == 0 && dataGridView1.Rows[e.RowIndex].Cells[0] is DataGridViewComboBoxCell && dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString() == "Outros")
{
dataGridView1.Rows[dagdvwrowindex].Cells[0] = new DataGridViewTextBoxCell();
}
There are 2 problems:
1) it doesnt really triggers when i want as i have to select another cell for that event to trigger rather than immediatelly trigger after another value has been selected
2) I get this really neat and awsome error: Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.
Im kinda hitting a dead end for finding workarounds, can someone please help me with this?
Thanks very much in advance!
Re: how to programmatically change a a cell from a datagridview combobox to textbox?
Just an idea...why not create the two control on there and set the textbox to be invisible. If you select an item from the drop down list then the textbox show and the drop down not.
If the textbox is double clicked then the drop down reappears and the textbox disappears..
Hope this helps.
Re: how to programmatically change a a cell from a datagridview combobox to textbox?
Quote:
Originally Posted by
Greyskull
Just an idea...why not create the two control on there and set the textbox to be invisible. If you select an item from the drop down list then the textbox show and the drop down not.
If the textbox is double clicked then the drop down reappears and the textbox disappears..
Hope this helps.
hello, thanks for your replies, how would you create both controls on the same column? o.O