I am trying Display the contents of the file on a form, 20 at a time. I can do this but i cant get ut to show the next 20 and the next 20 behind the same button. any suggestions
Printable View
I am trying Display the contents of the file on a form, 20 at a time. I can do this but i cant get ut to show the next 20 and the next 20 behind the same button. any suggestions
Post your code.
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
Private Sub cmdNext_Click()
'when clicking on next button
'move the pointer(fCurRec) forwards
'If fCurRec < gNumRecs Then
'fCurRec = fCurRec + 1
'Else 'Unless were at the last record
'fCurRec = 1 'wrap around to 1st record
'End If
' No We Display the Array Element
' In the Text Boxes
Dim CurList As Integer
Cls
CurList = 1
dblNum = I
Print "Name", "Telephone Number" & _
vbCrLf & "------------------------------------------------------"
CurList = CurList + 1
For I = 1 To 20 'dblNum is my total loaded data so I = 1 to dblNum
Print gStreetNum(I); Tab(13); gStreetName(I); Tab(34); gSuburb(I); Tab(59); gPostalCode(I); Tab(74); gPrice(I)
Next I
Print "End of list"
End Sub
Have a static variable and increment this on every click. e.g.
private Sub cndNext_Click()
static StartFrom as Long
'\\ as your code then...
for I = (StartFrom + 1) to (DtartFrom + 20)
'\\ as your code
next I
'\\ Now increment the startfrom
StartFrom = StartFrom + 20
End Sub
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
dblNum = I
where does I come from? you said your total loaded data.
So, I assume it may be greater than 20.
If it is right, and what are you looking for is a way to print on form other 20 at a time, this is the line to change:
static oldcount as integer
dim addcount as integer
addcount = oldcount*20
For I = 1 To 20 'dblNum is my total loaded data so I = 1 to dblNum
'dblNum may be greater than 20?
Print gStreetNum(I+addcount); Tab(13); gStreetName(I+addcount); Tab(34); gSuburb(I+addcount); Tab(59); gPostalCode(I+addcount); Tab(74); gPrice(I+addcount)
Next I
oldcount = oldcount+1
do not forget to reset oldcount to 0 when you read a new record or you reach the end of the array
Hope I got the point and this helped you.
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
As usual, you're more direct, faster and clearer!
Only a pity I am out of vote for today...
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
thanks a million dude? cheers!