Results 1 to 2 of 2

Thread: Databinding and textboxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    4

    Question Databinding and textboxes

    Hi guys,

    I've been searching around for information on how to make textboxes display the data on my sql database. For example, when I click on a field in the datagridview, it will display all the information in that row in different textboxes.

    How can I do that? Are there any tutorials on SELECT WHERE statements? Hope you get what I mean

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

    Re: Databinding and textboxes

    http://www.vbforums.com/showthread.php?t=469872

    Retrieve your data into a DataTable, then bind that DataTable to a BindingSource:
    vb.net Code:
    1. myBindingSource.DataSource = myDataTable
    Bind the BindingSource to both the grid and the TextBox:
    vb.net Code:
    1. myDataGridView.DataSource = myBindingSource
    2. myTextBox.DataBindings.Add("Text", myBindingSource, "ColumnNameHere")
    That's it. The rest is taken care of for you.
    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

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