|
-
Mar 9th, 2013, 07:19 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Datagridview combo column error
Hi Guys,
I have a datagridview control in my form. It has a few combo box type columns. What I want is to dynamically populate them ? No databases.
I am getting error "DataGridViewComboBoxCell value is not valid" when I populate the combo cell values manually.
For e.g. in DataGridView1_EditingControlShowing event, I wrote :
If DataGridView1.CurrentCell.ColumnIndex = 1 Then
Dim combo As ComboBox = CType(e.Control, ComboBox)
combo.Items.Add("Hello")
combo.Items.Add("Bye")
End If
Next I wanted to write that if value in col 1 is abcd then populate ... values in col 2. But I am getting the same error.
Can individual cells (combo type) have different values.
Please let me know what mistake I am making.
Thank you,
Cheers,
GR
Last edited by greatchap; Mar 9th, 2013 at 07:40 AM.
-
Mar 9th, 2013, 07:42 AM
#2
Re: Datagridview combo column error
Yes individual cells can have different values.
The code you posted works. Could you conjure up code that cause the failure ?
-
Mar 9th, 2013, 08:31 AM
#3
Thread Starter
Fanatic Member
Re: Datagridview combo column error
I got it. The wrote the code in a new event called CellBeginEdit. plus i made a change Dim combobox As DataGridViewComboBoxCell = Grid1.CurrentCell
Cheers.
Tags for this Thread
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
|