Well, you're on the right track, but you're trying to bind a control to a single value. I'll try to give you a working example:
Imports System.Data.OleDb
Public Class Form1
Private Const dbLoc As String = "D:\something.mdb"
Private Const password As String = "something"
Public connectionString As OleDbConnection
Public boolLoading As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
connectionString = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & dbLoc & _
";Jet OLEDB:Database Password=" & password)
Try
connectionString.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Dim cbo1DataSet As New DataSet
Dim myDataAdapter As OleDbDataAdapter
Dim sql As String = "SELECT * FROM TreeData;"
myDataAdapter = New OleDbDataAdapter(sql, connectionString)
myDataAdapter.Fill(cbo1DataSet, "TreeData")
myDataAdapter.Dispose()
boolLoading = True
With ComboBox1
.DataSource = cbo1DataSet.Tables("TreeData")
.DisplayMember = "Display_Name"
.ValueMember = "DataID"
.SelectedIndex = 0
End With
boolLoading = False
connectionString.Close()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If boolLoading Then Return
Try
connectionString.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Dim cbo2DataSet As New DataSet
Dim myDataAdapter As OleDbDataAdapter
Dim sql As String = "SELECT * FROM Data WHERE ID=" & ComboBox1.SelectedValue & ";"
myDataAdapter = New OleDbDataAdapter(sql, connectionString)
myDataAdapter.Fill(cbo2DataSet, "Data")
myDataAdapter.Dispose()
With ComboBox2
.DataSource = cbo2DataSet.Tables("Data")
.DisplayMember = "Name"
.ValueMember = "ID"
.SelectedIndex = 0
End With
connectionString.Close()
End Sub
End Class