B
B. Meincke
What I want to do for April Fools day is reprogram all the command buttons on
our attendance database switchboard such that when a teacher moves the mouse
over it, it moves. I have the following:
Private Sub Command0_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Command0.Left = Command0.Left + ((1 + Int(500 * Rnd())))
Command0.Top = Command0.Top + ((1 + Int(500 * Rnd())))
End Sub
This works beautifully, until the button reaches the bottom or right-hand
side of the form, then, of course, I get an error message as the Left or Top
value becomes invalid.
Is there any way I can revise this code so that if the button hits the wall,
so to speak, it will turn around and go the other way, or make the button
movement completely random as opposed to it moving only down and to the right?
Thanks for any help in advance.
And...shhh! <G>
our attendance database switchboard such that when a teacher moves the mouse
over it, it moves. I have the following:
Private Sub Command0_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Command0.Left = Command0.Left + ((1 + Int(500 * Rnd())))
Command0.Top = Command0.Top + ((1 + Int(500 * Rnd())))
End Sub
This works beautifully, until the button reaches the bottom or right-hand
side of the form, then, of course, I get an error message as the Left or Top
value becomes invalid.
Is there any way I can revise this code so that if the button hits the wall,
so to speak, it will turn around and go the other way, or make the button
movement completely random as opposed to it moving only down and to the right?
Thanks for any help in advance.
And...shhh! <G>