Question Changing DataGridViewCell from DataGridViewTextBoxCell to DataGridViewComboBoxCell

VBobCat

Well-known member
Joined
Sep 6, 2011
Messages
137
Location
S?o Paulo, Brazil
Programming Experience
3-5
I have a DataGridView with two columns:
The first column's cells are of type DataGridViewCheckBoxCell
I'm already able to catch its validation and get its value, whether true or false.
Now I want to do something I don't know how (and if) is possible:
- If the value of the cell in first column is true, I want the cell of same row in second column to be a DataGridViewComboBoxCell, so user is constrained to its listed options;
- If the value of the cell in first column is false (most common), I want the cell of same row in second column to be a DataGridViewTextBoxCell, so user can type whatever he wants.
Where should I start?
Thank you very much!
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,558
Location
Norway
Programming Experience
10+
You can set a cell to a different type like this:
Me.DataGridView1.Item(1, e.RowIndex) = New DataGridViewTextBoxCell
 
Top Bottom