By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,326 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,326 IT Pros & Developers. It's quick & easy.

MouseMove event not firing

P: n/a
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.
Mar 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"TyBreaker" <ty*********@SPAMhotmail.com> schreef in bericht
news:uI**************@TK2MSFTNGP10.phx.gbl... 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.

Mar 24 '06 #2

P: n/a
Peter Proost wrote:
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


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.
Mar 24 '06 #3

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

Greetz, Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"TyBreaker" <ty*********@SPAMhotmail.com> schreef in bericht
news:Oh*************@TK2MSFTNGP12.phx.gbl...
Peter Proost wrote:
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


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.

Mar 24 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.