|
-
Feb 6th, 2012, 06:19 AM
#1
Thread Starter
Hyperactive Member
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!
-
Feb 9th, 2012, 10:34 AM
#2
Hyperactive Member
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.
Please go to the Thread Tools menu and click Mark Thread Resolved when your post is answered 
If someone helped you today then please consider rating their post.
-
Feb 9th, 2012, 02:29 PM
#3
Thread Starter
Hyperactive Member
Re: how to programmatically change a a cell from a datagridview combobox to textbox?
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|