By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

Litle Problem Help Plz

P: n/a
I have create a very simple program in my Visual Basic 2005 Pro.

I retrive some records from my database and then i have bind some text
fields to that data.

When the application starts then the text fields are showing the first
record of the table.

After that i have add a button to move the records to the next and
next and so on and on label to showing the current position.

The problem is that the label showing the new position but the text
fields are not changing the values.

Why ? ? ?

THE CODE
Public Class Form1
Private Sub CustomersBindingNavigatorSaveItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.CustomersBindingSource.EndEdit()

Me.CustomersTableAdapter.Update(Me.NorthwindDataSe t.Customers)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'NorthwindDataSet.Customers' table. You can move, or remove it, as
needed.
Me.CustomersTableAdapter.Fill(Me.NorthwindDataSet. Customers)
Me.Label3.Text = Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position
End Sub
Private Sub CustomersBindingSource_CurrentChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource.CurrentChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position
=
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position + 1
Me.BindingContext(Me.NorthwindDataSet,
"Customers").EndCurrentEdit()
Call PositionChanged()
End Sub
Private Sub PositionChanged()
Me.Label3.Text = ((Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position + 1).ToString & " / " &
Me.BindingContext(Me.NorthwindDataSet, "Customers").Count.ToString)
End Sub
Private Sub CustomersBindingSource1_CurrentChanged(ByVal sender
As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource1.CurrentChanged
End Sub
End Class
Thanks a lot . . .

Mar 16 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try CustomersBindingSource.MoveNext instead of using the BindingContext.

Robin S.
------------------------------
"CorfuVBProgrammer" <me***********@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
>I have create a very simple program in my Visual Basic 2005 Pro.

I retrive some records from my database and then i have bind some text
fields to that data.

When the application starts then the text fields are showing the first
record of the table.

After that i have add a button to move the records to the next and
next and so on and on label to showing the current position.

The problem is that the label showing the new position but the text
fields are not changing the values.

Why ? ? ?

THE CODE
Public Class Form1
Private Sub CustomersBindingNavigatorSaveItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.CustomersBindingSource.EndEdit()

Me.CustomersTableAdapter.Update(Me.NorthwindDataSe t.Customers)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'NorthwindDataSet.Customers' table. You can move, or remove it, as
needed.
Me.CustomersTableAdapter.Fill(Me.NorthwindDataSet. Customers)
Me.Label3.Text = Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position
End Sub
Private Sub CustomersBindingSource_CurrentChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource.CurrentChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position
=
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position + 1
Me.BindingContext(Me.NorthwindDataSet,
"Customers").EndCurrentEdit()
Call PositionChanged()
End Sub
Private Sub PositionChanged()
Me.Label3.Text = ((Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position + 1).ToString & " / " &
Me.BindingContext(Me.NorthwindDataSet, "Customers").Count.ToString)
End Sub
Private Sub CustomersBindingSource1_CurrentChanged(ByVal sender
As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource1.CurrentChanged
End Sub
End Class
Thanks a lot . . .

Mar 16 '07 #2

P: n/a
Thanks . . .

Was so esey . . .

Thanks a lot . . .

Have a nice day . . . :D

Mar 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.