Imports System
Imports System
SqlClient Public Class Form1 Dim i As Integer Dim ds As New DataSet() Dim sql As String Dim con As SqlConnection Dim da As SqlDataAdapter Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con = New SqlConnection("Data Source=USER-PC;Initial Catalog=employee;User ID=sa;Password=corolla") con.Open() sql = "SELECT * from emp" da = New SqlDataAdapter(sql, con) da.Fill(ds, "emp") ' TextBox1.DataBindings.Add("text", dt, "emp.empid") 'TextBox1.Text = "Hello" TextBox1.Text = ds.Tables("emp").Rows(i).Item(0) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If i < ds.Tables("emp").Rows.Count - 1 Then i = i + 1 TextBox1.Text = ds.Tables("emp").Rows(i).Item(0) Else MessageBox.Show("SSSSSSSSSSSS") End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If i = ds.Tables("emp").Rows.Count - 1 Or i <> 0 Then i = i - 1 TextBox1.Text = ds.Tables("emp").Rows(i).Item(0) Else MessageBox.Show("AAAAAAAAAAAAA") End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If i <> 0 Then i = 0 TextBox1.Text = ds.Tables("emp").Rows(i).Item(0) End If End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click If i <> ds.Tables("emp").Rows.Count - 1 Then i = ds.Tables("emp").Rows.Count - 1 TextBox1.Text = ds.Tables("emp").Rows(i).Item(0) End If End Sub End Class