Please i have a problem i cant resolve. I was able to populate my combobox (Cus_ID) from TLB_Customer table sucessfully. Now, how ca i use the same populated combobox to populate a textbox (Cus_Name) all in the same TLB_Customer table.
My Code
Imports System.Data.OleDb
Public Class frmTransaction
Dim con As New OleDbConnection
Private Sub frmTransaction_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Connection String
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\YHFarm.mdb"
'Open Connection
con.Open()
'Referesh Controls
RefreshControls()
End Sub
Public Sub RefreshControls()
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\YHFarm.mdb"
Dim cmd As New OleDbCommand
con.Open()
cmd.Connection = con
cmd.CommandText = "select Cus_ID from TLB_Customer"
Dim dr As OleDbDataReader = cmd.ExecuteReader
While dr.Read
Cus_ID.Items.Add(dr.Item("Cus_ID"))
End While
dr.Close()
End Sub
End Class