The following code snippet (The question is here: http://www.vbdotnetforums.com/winforms-grids/10038-fill-datagridview-combobox-column.html) is for filling a combobox cell in a datagridview in unbound mode:
Dim dgvcc As DataGridViewComboBoxCell
dgvcc = DataGridView1.Rows(2).Cells(0)
dgvcc.Items.Add("comboitem1")
dgvcc.Items.Add("comboitem2")
I'm trying to do likewise but I can't help but notice that the casting operation is invalid and that's the exact error VB gives me.
I've tweaked the code a bit and tried it but still I get the same casting error:
Dim dgvcc As Windows.Forms.DataGridViewComboBoxCell
dgvcc = Window.DataGridView1.Rows(2).Cells(0)
dgvcc.Items.Add("comboitem1")
dgvcc.Items.Add("comboitem2")
Window is the name of the form in which the DataGridView1 objet is.
Can anyone please show me an easy method to fill a combobox in a datagridview in unbound mode. You can as well tell me why it did not work for me and why it is working for others?