|
-
Jan 28th, 2007, 12:39 PM
#1
[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:
'all in form load
Dim MyConnection As New SqlClient.SqlConnection(ConnString)
Dim MyAdapter As New SqlClient.SqlDataAdapter(strViewStaff, MyConnection)
Dim MyDataSet As New DataSet("Staff")
MyAdapter.Fill(MyDataSet)
Dim BindSource As New BindingSource
BindSource.DataSource = MyDataSet.Tables(0)
BindingNavigator1.BindingSource = BindSource
txtName.DataBindings.Add("Text", BindSource.DataSource, "Name")
txtID.DataBindings.Add("Text", BindSource.DataSource, "StaffID")
-
Jan 28th, 2007, 12:44 PM
#2
Re: Problem with BindingNavigator
Had to change the the databindings to reflect the bindingnavigator's bindingsource...
VB Code:
txtName.DataBindings.Add("Text", BindingNavigator1.BindingSource, "Name")
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|