Results 1 to 2 of 2

Thread: [RESOLVED] Problem with BindingNavigator

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Resolved [RESOLVED] Problem with BindingNavigator

    Rather new to messing with databases, and trying to do a simple bindingnavigator to move through the records in one particular table. I have two textboxes that are bound, and when the form loads, the first record is displayed fine. However, when trying to move to the next record using the bindingnavigator, the number increases (on the bindingnavigator control, so it seems it is moving to the next record fine), yet the textbox values do not change. What am I missing?
    VB Code:
    1. 'all in form load
    2.         Dim MyConnection As New SqlClient.SqlConnection(ConnString)
    3.         Dim MyAdapter As New SqlClient.SqlDataAdapter(strViewStaff, MyConnection)
    4.         Dim MyDataSet As New DataSet("Staff")
    5.         MyAdapter.Fill(MyDataSet)
    6.         Dim BindSource As New BindingSource
    7.         BindSource.DataSource = MyDataSet.Tables(0)
    8.         BindingNavigator1.BindingSource = BindSource
    9.         txtName.DataBindings.Add("Text", BindSource.DataSource, "Name")
    10.         txtID.DataBindings.Add("Text", BindSource.DataSource, "StaffID")

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Problem with BindingNavigator

    Had to change the the databindings to reflect the bindingnavigator's bindingsource...
    VB Code:
    1. txtName.DataBindings.Add("Text", BindingNavigator1.BindingSource, "Name")
    2. txtID.DataBindings.Add("Text", BindingNavigator1.BindingSource, "StaffID")

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