470,602 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,602 developers. It's quick & easy.

Problem navigating data in simple Windows form

Hi All,
I am trying to create a simple Windows form that lists a users' data
one user at a time with the usual "Next" & "Previous" buttons.
Upon loading the form, I am able to populate all textboxes however
when clicking either of the buttons, nothing happens - the data from
the next/previous rows does not re-populate the textboxes. This is an
extremely simple situation yet I cannot figure out what is going
wrong.

Can anyone help? I've attached what little code I have to offer...

Private Sub EmployeesList_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
DataSet11.Clear()
SqlDataAdapter1.Fill(DataSet11)
SqlDataAdapter1.Fill(ds, "Employees")
End Sub

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Me.BindingContext(ds, "Employees").Position += 1
End Sub

Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnPrevious.Click
Me.BindingContext(ds, "Employees").Position -= 1
End Sub

Thanks,
Vic
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #1
1 1336
Hi Victor,

When people using the desiger it is always difficult to see what goes wrong.

In code you have to do this for every textbox, however you can do it as well
with the designer in databindings from the propertybox and than bind there
"Text" properties one by one to the dataset table..

You can do it also after the fill of the dataset.
textbox1.DataBindings.Add(New Binding("Text", ds.Tables(0), "MyDataField"))

Did you do that?

Cor
Hi All,
I am trying to create a simple Windows form that lists a users' data
one user at a time with the usual "Next" & "Previous" buttons.
Upon loading the form, I am able to populate all textboxes however
when clicking either of the buttons, nothing happens - the data from
the next/previous rows does not re-populate the textboxes. This is an
extremely simple situation yet I cannot figure out what is going
wrong.

Can anyone help? I've attached what little code I have to offer...

Private Sub EmployeesList_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
DataSet11.Clear()
SqlDataAdapter1.Fill(DataSet11)
SqlDataAdapter1.Fill(ds, "Employees")
End Sub

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Me.BindingContext(ds, "Employees").Position += 1
End Sub

Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnPrevious.Click
Me.BindingContext(ds, "Employees").Position -= 1
End Sub

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Lerp | last post: by
30 posts views Thread by dbuchanan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.