reading from a table

Apr 6, 2005
Programming Experience
i am trying to get my vbnet program to read from the table,i have found a way to read colmuns but how do i read from rows.

 TextBox1.Text = dr(0)
				TextBox2.Text = dr(1)
				TextBox3.Text = dr(2)

this will read across the first row but how do i get it to go to the next row as well ?

"dt" is a DataTable object, but that is assuming that your "dr" is a DataRow and not a DataReader. If you Fill a DataTable, either stand-alone or in a DataSet using a DataAdapter, use mzim's method to read each row from the table. If you ExecuteReader on a Command, call Read on the DataReader to read each row.
A possibility to go through your datarows:
Dim con As New SqlConnection(<connectionstring>)
Dim myDapt As New SqlDataAdapter
Dim mySet As New DataSet
Dim cmdSelect As New SqlCommand
Dim bm As BindingManagerBase
With myDapt
.SelectCommand = cmdSelect
End With
With cmdSelect
.CommandType = CommandType.Text
.CommandText = "Select * From <table>"
.Connection = con
End With
myDapt.Fill(mySet, <tablename as string>)
bm = Me.BindingContext(mySet, <tablename as string>)
TextBox1.DataBindings.Add(New Binding("Text", mySet, <columnname as string> ))
TextBox2.DataBindings.Add(New Binding("Text", mySet, <columnname as string>))
TextBox3.DataBindings.Add(New Binding("Text", mySet, <columnname as string>))

Now that this is done, you can go through the datarows by making some buttons:

Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click

With bm
  If .Position <> 0 Then
	.Position -= 1
  End If
End With
End Sub 

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click

With bm
  If .Position <> .Count - 1 Then
	.Position += 1
  End If
End With
End Sub