CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Next 20 button?

  1. #1
    Join Date
    Apr 2001
    Posts
    6

    Next 20 button?

    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


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Next 20 button?

    Post your code.

    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Apr 2001
    Posts
    6

    Re: Next 20 button?


    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


  4. #4
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Next 20 button?

    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
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Next 20 button?

    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.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Next 20 button?

    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.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  7. #7
    Join Date
    Apr 2001
    Posts
    6

    Re: Next 20 button?

    thanks a million dude? cheers!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured