Results 1 to 5 of 5

Thread: Code to show the records in textboxes?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2007
    Posts
    788

    Code to show the records in textboxes?

    Dear Friends,

    How can we show the records in the textboxes in VS2008? I used the following code in VB6 to perform this action:

    Code:
    Public Sub Show_Record()
    If Not (rs.BOF Or rs.EOF) = True Then
    txtSNO = rs(0) & ""
    txtPRN = rs(1) & ""
    txtPRL = rs(2) & ""
    txtDESC = rs(3) & ""
    End If
    End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Code to show the records in textboxes?

    Use a DataAdapter to populate a DataTable. Bind that Datatable to a BindingSource. Bind that BindingSource to your controls. To navigate, call MoveNext, MovePrevious, etc, on the BindingSource
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2007
    Posts
    788

    Re: Code to show the records in textboxes?

    Quote Originally Posted by jmcilhinney View Post
    Use a DataAdapter to populate a DataTable. Bind that Datatable to a BindingSource. Bind that BindingSource to your controls. To navigate, call MoveNext, MovePrevious, etc, on the BindingSource
    Thanks. There is no such code to written. If not, please give me any example on how to use DataAdaptor?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Code to show the records in textboxes?

    Follow the Database FAQ link in my signature.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Re: Code to show the records in textboxes?

    if you keep going like this(i.e;keep on showing vb6 codes and ask for the corresponding vb.net codes) then things are not going to help you either.All you need is to take your time to read some ebooks along with the articles present on the internet,keep trying out some examples of yourself and i can bet you wont take more than 3 days to learn ado.net

    if your code does not work then post here your code and we are here to help you out....but frankly speaking showing vb6 codes wont help at all

    now its upto you which way to go

    If you find my reply helpful , then rate it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width