MouseMove event not firing

T

TyBreaker

I'm writing a screen saver using Visual Studio 2005 (Basic) and I have a
Form which contains a PictureBox. I have two events, Click and
MouseMove that I'd like to cause the program to end (see below) as one
would expect from a screen saver. Well my Click event fires but for
some reason my MouseMove event does not. Both the Form and the
PictureBox are enabled.

In my Form_Load routine, I tried placing "Me.Capture = true" which
according to the help says it grabs all mouse events - even if the mouse
is outside the control (my form starts maximised so this shouldn't be a
problem). MouseMove then fires correctly but the Click event then takes
two clicks before it fires. Frustrating! I just want my application to
end when either event happens.

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox1.Click
End
End Sub

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles Me.MouseMove
End
End Sub

Grateful for any assistance :)
--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.

--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
P

Peter Proost

Hi tybreaker,

shouldn't Me.MouseMove be PictureBox1.MouseMove
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles Me.MouseMove
End
End Sub

should be
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles PictureBox1.MouseMove
End
End Sub

hth Greetz Peter
 
T

TyBreaker

Peter said:
Hi tybreaker,

shouldn't Me.MouseMove be PictureBox1.MouseMove


should be
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles PictureBox1.MouseMove
End
End Sub

hth Greetz Peter

Wow, thank you. My ignorance of the language is obvious! I'm not sure
how I mucked that up - the routine declarations get inserted
automatically but I must have done something to stuff it up at some point.
--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
P

Peter Proost

Glad I could help you, but that's what we're here for, to help each other
:)

Greetz, Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top