|
-
May 21st, 2007, 10:07 AM
#1
Thread Starter
Addicted Member
[RESOLVED] DataGridViewComboBoxCell value is invalid
I have a DataGridView which contains a column of type DataGridViewComboBoxColumn. As I populate this column, everything is fine until the row added contains a different ComboBox item than the previous line. From this point on every additional row added gets the error:
DataGridViewComboBoxCell value is invalid
Here is the code:
Code:
Dim DataTypeColumn As New DataGridViewComboBoxColumn
' Setup ComboItems for Data Type
DataTypeColumn.Items.Clear()
DataTypeColumn.Items.Add("Bit")
DataTypeColumn.Items.Add("TinyInt")
DataTypeColumn.Items.Add("SmallInt")
DataTypeColumn.Items.Add("Int")
DataTypeColumn.Items.Add("VarChar")
DataTypeColumn.Items.Add("Decimal")
For iIndex = 0 To myTable.Rows.Count - 1
With dgvPartSetup
.Rows(iIndex).Cells(4).Style.BackColor = Color.FromArgb(224, 224, 224)
.Rows(iIndex).Cells(4).ReadOnly = True
.Rows(iIndex).Cells(4).Value = sDataType
End With
Next iIndex
Like I mentioned for the first 7 or so values sDataType = "Decimal" and everything works just fine. The next row, it happens to be "VarChar" and then for all the remaining rows including any subsequent "Decimal" values I get the above error. Any Ideas?
-
May 21st, 2007, 01:03 PM
#2
Thread Starter
Addicted Member
Resloved: DataGridViewComboBoxCell value is invalid
The problem ended up being that the incoming data had some upper/lower case character differences. In the debugger, when I asked if they were equal it told me True. They contained the same characters, but not always the exact same case...
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
|