Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

5.9 Displaying Database Data in Visual Basic Textboxes

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
21,294
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 16, 2010

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

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (Firchild)

  • thank you this is great! but you know when you click on the button you can go position +1 or position -1..is there anyway of making it random everytime?

    becuase im trying to create a quiz and i dont want the questions to appear in the same order

  • @ddpp08 That's an excellent question, and I can see exactly where you're coming from.. I'm afraid in VB, I'm not sure how, I know in actionscript, I'd use a RND command to select a random number and assign that to an array.. I can look into it, but I'm really busy at the moment, so I can't guarantee a quick response... Any of you guys out there have a suggestion? You normally save my bacon when I can't get the answer!

  • how did you get the oleDbAdapter and oleDBCommand?

  • @glaiveorb Have a little look at my previous tutorials, it's all in there. They're done sequentially

  • were is your desktop background from? that is awesome pic of london

  • @brianlb78 built into windows 7

see all

All Comments (17)

Sign In or Sign Up now to post a comment!
  • Great tutorial, thanks a lot.

  • Great video.

    Best desktop pic ever.

  • great vid

    learned more from this vid than full year of useless lectures

    saved me life wit a assignment

  • VB 2010 does a lot of this automatically however i still found this video useful to understand why it does it. thanks.

  • thanks in advance

  • thanks....the way u explain the tutorials very good n easy to understand....

  • @Firchild yep assigning it to an array is what i thought of originally but im really new to this language and i have no idea how to do it, when you are free, if you could upload a video on that pleasee thank you very much

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more