CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Posts
    91

    jumping to next record

    Hi,
    Maybe a beginners question, but ...
    I have a button, that onclick goes to the next record of my form.
    My question now is: how can I repeat this, as long as the user holds the button down?

    Patzer

    have a nice day,

    Patzer
    have a nice day

    Patzer
    _____________________________
    Philo will never be forgotten

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: jumping to next record

    You can use the MouseDown and MouseUp events of the button. In the mousedown start looping until the mouseup occurs.

    Dim ButtonPressed as Boolean
    private Sub Command1_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
    ButtonPressed = true
    Dim LastSec as integer
    Do While ButtonPressed
    ' this is to foresee a delay
    ' we dont want the user seeing 500 recs in a second.
    If LastSec <> DatePart("s",now) then
    if not(rst.eof) then
    rst.movenext
    end if
    LastSec = DatePart("s",now)
    end if
    ' WARNING: YOU MUST USE DOEVENTS IN ORDER to TRAP THE MOUSEUP EVENT!
    DoEvents
    Loop
    End Sub

    private Sub Command1_MouseUp(Button as Integer, Shift as Integer, X as Single, Y as Single)
    ButtonPressed = false
    End Sub





    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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