Click to See Complete Forum and Search --> : Next 20 button?


azura107
April 11th, 2001, 03:53 AM
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

Cimperiali
April 11th, 2001, 05:01 AM
Post your code.

Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.

azura107
April 11th, 2001, 05:07 AM
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

Clearcode
April 11th, 2001, 05:28 AM
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

Cimperiali
April 11th, 2001, 05:31 AM
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.

Cimperiali
April 11th, 2001, 05:32 AM
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.

azura107
April 11th, 2001, 05:56 AM
thanks a million dude? cheers!