Hierin gaat fout de IDlist en Valuelist
Bij IdList = ds.Tables(0).Rows(i).Item(0)
ValueList = ds.Tables(0).Rows(i).Item(1)
Volgens mij moet ik deze delareren, maar als wat?
Bij IdList = ds.Tables(0).Rows(i).Item(0)
ValueList = ds.Tables(0).Rows(i).Item(1)
Volgens mij moet ik deze delareren, maar als wat?
Code:
Private Sub TakenVullen()
Dim irij As Integer
Dim iAantalItems As Integer
ds.Clear()
Try
Dim ds As DataSet = New DataSet
mySQL = "SELECT * from TaakItems"
da = New OleDb.OleDbDataAdapter(mySQL, Conn)
da.Fill(ds, "Zorgboerderij")
Dim iAantal As Integer = ds.Tables("Zorgboerderij").Rows.Count
' MsgBox(iAantal)
iAantalItems = 0
irij = 0
For i As Integer = 0 To iAantal - 1 Step 1
ReDim Preserve IdList(iAantalItems)
ReDim Preserve ValueList(iAantalItems)
With ListboxBron
.IdList = ds.Tables(0).Rows(i).Item(0)
.ValueList = ds.Tables(0).Rows(i).Item(1)
End with
iAantalItems = iAantalItems + 1
'irij = irij + 1
Next i
Catch ex As Exception
MessageBox.Show(ex.Message, "ERROR Listboxvullen", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
Conn.Close()
da.Dispose()
End Try
End Sub
Laatst bewerkt: