Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form1.Hide()
Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\project2\project\project.mdb"
Dim conn As New OleDbConnection(conStr)
conn.Open()
Dim sql As String = "SELECT * FROM department "
Dim cmd As New OleDbCommand(sql, conn)
Dim adapter As New OleDbDataAdapter(cmd)
Dim data As New DataSet()
adapter.Fill(data, "department")
Dim name As String = ""
For i = 0 To data.Tables("department").Rows.Count - 1
name = data.Tables("department").Rows(i)("dep_name")
With ComboBox1
ComboBox1.Items.Add(name)
.DisplayMember = "dep_name"
.ValueMember = "dep_id"
End With