Thanks so much for the response everyone - this is the stripped down code
The problem is the combobox values
- Dim dropcolumn As New DataGridViewComboBoxColumn
-
Dim CheckColumn As New DataGridViewCheckBoxColumn
-
Dim CheckColumn2 As New DataGridViewCheckBoxColumn
-
-
Dim i As Integer = 0
-
Dim temp As String = ""
-
-
With dropcolumn
-
.Name = "Something1"
-
.HeaderText = " Something1"
-
For i = 0 To 255
-
temp = array(i)
-
If temp = "U" Then
-
.Items.Add("Stock" + Str(i))
-
End If
-
Next
-
End With
-
-
With CheckColumn
-
.Name = "Something2"
-
.HeaderText = " Something2"
-
End With
-
-
With CheckColumn2
-
.Name = "Something3"
-
.HeaderText = " Something3"
-
End With
-
-
DG1.Columns.Insert(0, dropcolumn)
-
DG1.Columns.Insert(1, CheckColumn)
-
DG1.Columns.Insert(2, CheckColumn2)
-
-
Dim Null_String As String = ""
-
With Me.DG1.Rows
-
.Add(Null_String)
-
End With
-
-
DG1.Rows(0).Cells(1).Value = True
-
DG1.Rows(0).Cells(2).Value = True
This seems to work fine although I'm not sure why I need the null_string but
without it I get the error that the following lines are out of range.
My problem is when I want to add or remove items from the combobox.
Once the users has chosen an item from the combobox I need it removed
so it cant be chesen again.
dropcolumn.Items.Remove("ITEMNAME")
dropcolumn.Items.Remove(index)
Seems to have no effect - but no errors either
Even rerunning
.items.clear
For i = 0 To 255
temp = array(i)
If temp = "U" Then
.Items.Add("Stock" + Str(i))
End If
Doesnt effect the combobox contents
Hope this is clearer, thanks again