Mouse pointer evading code for VB 6.0

How do I write the code in VB 6.0 for a form to evade the mouse pointer (i.e. for a programs that ask a user to click on "yes" or "no" and the "no" box moves away from the pointer when you try to click on it)


  • You wouldn't be talking about a certain "Salary Survey" that is circulating through email, would you?

    Sub cmdNo_MouseMove(......)

    cmdNo.Move NewX, NewY

    End Sub

  • Leachim,

    You're a credit to programmers everywhere. Thanks!

  • When I use this code, I get an error message stating "Compile Error: Expected: Identifier" and the (...) is highlighted. Any suggestions?

  • The first line of the code "Private Sub ..." was only meant to show you where to put the code. Put this in the mousemove event of the "No" button:

    cmdNo.Move NewX, NewY

    and replace cmdNo with the name of your Button, and NewX and NewY with the coordinates you wish to move thebutton to.

  • The code works great. Thanks. Now I'm trying to figure out how to keep the "No" form evading the mouse after the initial evasion. Your help was great. Thanks

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!