5.9 Displaying Database Data in Visual Basic Textboxes



23
189410

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

Published by: Firchild Published at: 13 years ago Category: آموزشی