5.9 Displaying Database Data in Visual Basic Textboxes
How to integrate Access and VB using text boxes to display data and buttons to navigate the records.
Here's the code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.LoadOleDbDataAdapter1.Fill(DsPatientsAndWard1)
txtWardName.DataBindings.Add("Text", DsPatientsAndWards1, "Patients.Ward Name")
txtWardClass.DataBindings.Add("Text", DsPatientsAndWards1, "Patients.Ward Class")
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles btnNext.Click
BindingContext(DsPatientsAndWards1, "Patients").Position = BindingContext(DsPatientsAndWards1, "Patients").Position + 1
End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
BindingContext(DsPatientsAndWards1, "Patients").Position = BindingContext(DsPatientsAndWards1,"Patients").Position -1
End Sub
End Class
Video Length: 10:41
Uploaded By: Firchild
View Count: 119,057