hello, im have problem with my code..im used access database, when i select combobox1, the textbox will appear data set as value member....but data not appear on textbox..someone can help me :)
this my code
Sub fillcombo()
Dim acscmd As New OleDb.OleDbCommand
acscmd.CommandText = strsql
acscmd.Connection = acsconn
acsdr = acscmd.ExecuteReader
While (acsdr.Read())
VehicleModel.Items.Add(acsdr("vehicleModel"))
End While
acscmd.Dispose()
acsdr.Close()
End Sub
Private Sub Schedule_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Module1.connect()
Me.fillcombo()
Private Sub VehicleModel_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VehicleModel.SelectedIndexChanged
strsql = "select * from tblVehicle where vehicleModel = ' " & VehicleModel.Text & "'"
Dim acscmd As New OleDb.OleDbCommand
acscmd.CommandText = strsql
acscmd.Connection = acsconn
acsdr = acscmd.ExecuteReader
If (acsdr.Read() = True) Then
VehiclePlat.Text = (acsdr("vehiclePlat"))
End If
acscmd.Dispose()
acsdr.Close()
End Sub
(in module)
Imports System.Data.OleDb
Module Module1
Public acsconn As New OleDb.OleDbConnection
Public acsdrr As OleDbDataReader
Public strsql As String
Sub connect()
acsconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\D_S_S\SystemData.mdb"
acsconn.Open()
End Sub
End Module