Üye Kayıt Üye Giriş

Geçerli Sayfayı Bulmak


Geçerli Sayfayı Bulmak

 
Option Explicit
Dim db As Connection
Dim lCurrentPage As Long

Private Sub cmdNext_Click()
lCurrentPage = lCurrentPage + 1
Call LoadListBox(lCurrentPage)
End Sub

Private Sub cmdPrevious_Click()
If lCurrentPage > 1 Then
lCurrentPage = lCurrentPage - 1
Call LoadListBox(lCurrentPage)
End If
End Sub

Private Sub Form_Load()

Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & AppPath & "test.mdb;"

lCurrentPage = 1
Call LoadListBox(lCurrentPage)

End Sub
Private Sub LoadListBox(lPage As Long)
Dim adoPrimaryRS As ADODB.Recordset
Dim lPageCount As Long
Dim nPageSize As Integer
Dim lCount As Long

nPageSize = 7
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from numbers", db, adOpenStatic, adLockOptimistic

adoPrimaryRS.PageSize = nPageSize
lPageCount = adoPrimaryRS.PageCount
If lCurrentPage > lPageCount Then
lCurrentPage = lPageCount
End If

txtPage.Text = lPage

adoPrimaryRS.AbsolutePage = lCurrentPage

With lbxRecords
.Clear
lCount = 0
Do While Not adoPrimaryRS.EOF
.AddItem adoPrimaryRS("aNumber")
lCount = lCount + 1
If lCount = nPageSize Then
Exit Do
End If
adoPrimaryRS.MoveNext
Loop

End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
If Not db Is Nothing Then
db.Close
End If
Set db = Nothing
End Sub
Public Function AppPath() As String

Dim sAns As String
sAns = App.Path
If Right(App.Path, 1) <> "\" Then sAns = sAns & "\"
AppPath = sAns

End Function

Bilgisayar Dershanesi Ders Sahibi;
Bilgisayar Dershanesi

Yorumlar

Yorum Yapabilmek İçin Üye Girişi Yapmanız Gerekmektedir.

ETİKETLER