Problem navigating data in simple Windows form

  • Thread starter Thread starter VictorT
  • Start date Start date
V

VictorT

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
 
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
 
Back
Top