Private Sub f_rent_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dock = DockStyle.Fill
'Me.cb_memid.Text = ""
SelectData()
End Sub
Public Sub SelectData()
Cnnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database/database.mdb;"
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = Cnnstring
.Open()
End With
Dim sqluser As String = ""
sqluser = "SELECT * FROM tb_member"
da = New OleDbDataAdapter(sqluser, Conn)
da.Fill(ds, "tb_member")
If ds.Tables("tb_member").Rows.Count <> 0 Then
IsFind = True
With cb_memid
'.ReadOnly = True
.DataSource = ds.Tables("tb_member")
.DisplayMember = "รหัสสมาชิก"
.ValueMember = "รหัสสมาชิก"
End With
txt_memname.Text = CStr(ds.Tables("tb_member").Rows(0).Item("ชื่อสมาชิก"))
Else
IsFind = False
cb_memid.DataSource = Nothing
End If
End Sub
Private Sub cb_id_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cb_memid.SelectedValueChanged
If cb_memid.Text = "" Then Exit Sub
SelectData()
End Sub