FirstADO Project
(AFOfirst PowerPoint)
Public Class
frmFirstADO
Inherits
System.Windows.Forms.Form
Dim
currMang As CurrencyManager
Private Sub frmFirstADO_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
MyBase.Load
'Fill the data set
dbAdapterFirst.Fill(DataSetFirst1)
'The currency manager allows
navigation through the rows
currMang = Me.BindingContext(DataSetFirst1,
"Donor2000")
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnFirst.Click
currMang.Position = 0
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnNext.Click
If currMang.Position < currMang.Count
- 1 Then
currMang.Position = currMang.Position + 1
'currMang.Position += 1
Else
currMang.Position = 0
End If
End Sub
Private Sub btnPrevious_Click(ByVal sender
As System.Object, ByVal
e As System.EventArgs) Handles
btnPrevious.Click
If currMang.Position = 0 Then
currMang.Position = 0
Else
currMang.Position = currMang.Position - 1
End If
End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnLast.Click
currMang.Position = currMang.Count - 1
End Sub
End Class
DonorFormCode Project
Public Class
frmDonorCode
Inherits
System.Windows.Forms.Form
Dim donorDT As New DataTable
Dim
rowIndx As Integer
Private Sub frmDonorCode_Load(ByVal sender
As System.Object, ByVal
e As System.EventArgs) Handles
MyBase.Load
Dim connStr As String =
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source =
C:\VBver6\VB98\Access2000\donor.mdb"
Dim sqlStr As String =
"Select * from Donor2000"
Dim dataAdapter As New
OleDb.OleDbDataAdapter(sqlStr, connStr)
dataAdapter.Fill(donorDT)
dataAdapter.Dispose()
FillTextBoxes()
End Sub
Sub FillTextBoxes()
txtDIdno.Text = CStr(donorDT.Rows(rowIndx)("DIdno"))
txtDName.Text = CStr(donorDT.Rows(rowIndx)("DName"))
End Sub
Private Sub btnReadNext_Click(ByVal sender
As System.Object, ByVal
e As System.EventArgs) Handles
btnReadNext.Click
If rowIndx <
donorDT.Rows.Count - 1 Then
rowIndx = rowIndx + 1
FillTextBoxes()
Else
rowIndx = 0
FillTextBoxes()
End If
End Sub
End Class