Connecting Tech Pros Worldwide Forums | Help | Site Map

Mouse location

Adriano
Guest
 
Posts: n/a
#1: Nov 20 '05
hello,

is there any code to catch mouse move?
I mean to catch X and Y locations on a form?

tnx in advance,
Adriano



rawCoder
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Mouse location


Hi Adriano,

Try handling the MouseMove Event and in the event arguments you will be able
to retrieve the Mouse Position Coordinates
something like this
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

Debug.WriteLine(e.X & "," & e.Y)

End Sub

Hope it helps
rawCoder

"Adriano" <adriano@tadaz.com> wrote in message
news:eRROj3YXEHA.1144@TK2MSFTNGP10.phx.gbl...[color=blue]
> hello,
>
> is there any code to catch mouse move?
> I mean to catch X and Y locations on a form?
>
> tnx in advance,
> Adriano
>
>[/color]


Adriano
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Mouse location


hello Coder,
I tried this but the following error message appears:

Method 'FormClick_MouseMove' cannot handle Event 'MouseMove' because they do
not have the same signature.

any other ideas?

"rawCoder" <rawCoder@hotmail.com> wrote in message
news:Ol1x5cZXEHA.644@tk2msftngp13.phx.gbl...[color=blue]
> Hi Adriano,
>
> Try handling the MouseMove Event and in the event arguments you will be[/color]
able[color=blue]
> to retrieve the Mouse Position Coordinates
> something like this
> Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As
> System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
>
> Debug.WriteLine(e.X & "," & e.Y)
>
> End Sub
>
> Hope it helps
> rawCoder
>
> "Adriano" <adriano@tadaz.com> wrote in message
> news:eRROj3YXEHA.1144@TK2MSFTNGP10.phx.gbl...[color=green]
> > hello,
> >
> > is there any code to catch mouse move?
> > I mean to catch X and Y locations on a form?
> >
> > tnx in advance,
> > Adriano
> >
> >[/color]
>
>[/color]


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#4: Nov 20 '05

re: Mouse location


* "rawCoder" <rawCoder@hotmail.com> scripsit:[color=blue]
> Try handling the MouseMove Event and in the event arguments you will be able
> to retrieve the Mouse Position Coordinates
> something like this
> Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As
> System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
>
> Debug.WriteLine(e.X & "," & e.Y)
>
> End Sub[/color]

Outside this event, you can use 'Cursor.Position' to get the mouse
position.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
rawCoder
Guest
 
Posts: n/a
#5: Nov 20 '05

re: Mouse location


Did you use the IDE to get the signature of method .. like from top
ComboBoxes by selecting Base and Overrides and then selecting MouseMove
method. Or did u write it yourself. If later is the case, do try it using
the IDE. You may wanna post the Signture here so that the problem can be
identified.

frankly I dont remember any signature.. not even Form_Load ... so gotta
trust the IDE. Thanx its not C# and the IDe is on our side;-)

Thank You
rawCoder

"Adriano" <adriano@tadaz.com> wrote in message
news:uAGKO%23aXEHA.2972@TK2MSFTNGP12.phx.gbl...[color=blue]
> hello Coder,
> I tried this but the following error message appears:
>
> Method 'FormClick_MouseMove' cannot handle Event 'MouseMove' because they[/color]
do[color=blue]
> not have the same signature.
>
> any other ideas?
>
> "rawCoder" <rawCoder@hotmail.com> wrote in message
> news:Ol1x5cZXEHA.644@tk2msftngp13.phx.gbl...[color=green]
> > Hi Adriano,
> >
> > Try handling the MouseMove Event and in the event arguments you will be[/color]
> able[color=green]
> > to retrieve the Mouse Position Coordinates
> > something like this
> > Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As
> > System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
> >
> > Debug.WriteLine(e.X & "," & e.Y)
> >
> > End Sub
> >
> > Hope it helps
> > rawCoder
> >
> > "Adriano" <adriano@tadaz.com> wrote in message
> > news:eRROj3YXEHA.1144@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > > hello,
> > >
> > > is there any code to catch mouse move?
> > > I mean to catch X and Y locations on a form?
> > >
> > > tnx in advance,
> > > Adriano
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Adriano
Guest
 
Posts: n/a
#6: Nov 20 '05

re: Mouse location


I'm a beginner so I used IDE to write the code,
here is the code:

Private Sub FormClick_MouseMove(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.MouseMove

TextBox3.Text = Form1.MousePosition.X

TextBox4.Text = Form1.MousePosition.Y

End Sub



"rawCoder" <rawCoder@hotmail.com> wrote in message
news:Ovu#LocXEHA.2408@tk2msftngp13.phx.gbl...[color=blue]
> Did you use the IDE to get the signature of method .. like from top
> ComboBoxes by selecting Base and Overrides and then selecting MouseMove
> method. Or did u write it yourself. If later is the case, do try it using
> the IDE. You may wanna post the Signture here so that the problem can be
> identified.
>
> frankly I dont remember any signature.. not even Form_Load ... so gotta
> trust the IDE. Thanx its not C# and the IDe is on our side;-)
>
> Thank You
> rawCoder
>
> "Adriano" <adriano@tadaz.com> wrote in message
> news:uAGKO%23aXEHA.2972@TK2MSFTNGP12.phx.gbl...[color=green]
> > hello Coder,
> > I tried this but the following error message appears:
> >
> > Method 'FormClick_MouseMove' cannot handle Event 'MouseMove' because[/color][/color]
they[color=blue]
> do[color=green]
> > not have the same signature.
> >
> > any other ideas?
> >
> > "rawCoder" <rawCoder@hotmail.com> wrote in message
> > news:Ol1x5cZXEHA.644@tk2msftngp13.phx.gbl...[color=darkred]
> > > Hi Adriano,
> > >
> > > Try handling the MouseMove Event and in the event arguments you will[/color][/color][/color]
be[color=blue][color=green]
> > able[color=darkred]
> > > to retrieve the Mouse Position Coordinates
> > > something like this
> > > Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As
> > > System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
> > >
> > > Debug.WriteLine(e.X & "," & e.Y)
> > >
> > > End Sub
> > >
> > > Hope it helps
> > > rawCoder
> > >
> > > "Adriano" <adriano@tadaz.com> wrote in message
> > > news:eRROj3YXEHA.1144@TK2MSFTNGP10.phx.gbl...
> > > > hello,
> > > >
> > > > is there any code to catch mouse move?
> > > > I mean to catch X and Y locations on a form?
> > > >
> > > > tnx in advance,
> > > > Adriano
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


rawCoder
Guest
 
Posts: n/a
#7: Nov 20 '05

re: Mouse location


Hi adriano,

I dont know how the IDE got it bungled , but the second argument should be
MouseEventArgs not EventArgs ... so your code should look like this

Private Sub FormClick_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

' You can use e.x here as this will have the coordinates as well and do type
cast
TextBox3.Text = e.x
TextBox4.Text = e.y

End Sub

Hope this helps.
rawCoder

"Adriano" <adriano@tadaz.com> wrote in message
news:uucJBMlXEHA.4000@TK2MSFTNGP09.phx.gbl...[color=blue]
> I'm a beginner so I used IDE to write the code,
> here is the code:
>
> Private Sub FormClick_MouseMove(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.MouseMove
>
> TextBox3.Text = Form1.MousePosition.X
>
> TextBox4.Text = Form1.MousePosition.Y
>
> End Sub
>
>
>
> "rawCoder" <rawCoder@hotmail.com> wrote in message
> news:Ovu#LocXEHA.2408@tk2msftngp13.phx.gbl...[color=green]
> > Did you use the IDE to get the signature of method .. like from top
> > ComboBoxes by selecting Base and Overrides and then selecting MouseMove
> > method. Or did u write it yourself. If later is the case, do try it[/color][/color]
using[color=blue][color=green]
> > the IDE. You may wanna post the Signture here so that the problem can be
> > identified.
> >
> > frankly I dont remember any signature.. not even Form_Load ... so gotta
> > trust the IDE. Thanx its not C# and the IDe is on our side;-)
> >
> > Thank You
> > rawCoder
> >
> > "Adriano" <adriano@tadaz.com> wrote in message
> > news:uAGKO%23aXEHA.2972@TK2MSFTNGP12.phx.gbl...[color=darkred]
> > > hello Coder,
> > > I tried this but the following error message appears:
> > >
> > > Method 'FormClick_MouseMove' cannot handle Event 'MouseMove' because[/color][/color]
> they[color=green]
> > do[color=darkred]
> > > not have the same signature.
> > >
> > > any other ideas?
> > >
> > > "rawCoder" <rawCoder@hotmail.com> wrote in message
> > > news:Ol1x5cZXEHA.644@tk2msftngp13.phx.gbl...
> > > > Hi Adriano,
> > > >
> > > > Try handling the MouseMove Event and in the event arguments you will[/color][/color]
> be[color=green][color=darkred]
> > > able
> > > > to retrieve the Mouse Position Coordinates
> > > > something like this
> > > > Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As
> > > > System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
> > > >
> > > > Debug.WriteLine(e.X & "," & e.Y)
> > > >
> > > > End Sub
> > > >
> > > > Hope it helps
> > > > rawCoder
> > > >
> > > > "Adriano" <adriano@tadaz.com> wrote in message
> > > > news:eRROj3YXEHA.1144@TK2MSFTNGP10.phx.gbl...
> > > > > hello,
> > > > >
> > > > > is there any code to catch mouse move?
> > > > > I mean to catch X and Y locations on a form?
> > > > >
> > > > > tnx in advance,
> > > > > Adriano
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Adriano
Guest
 
Posts: n/a
#8: Nov 20 '05

re: Mouse location


now it works fine!!!
i appreciate your time and help,

Adriano

"rawCoder" <rawCoder@hotmail.com> wrote in message
news:eK$reXmXEHA.3564@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi adriano,
>
> I dont know how the IDE got it bungled , but the second argument should be
> MouseEventArgs not EventArgs ... so your code should look like this
>
> Private Sub FormClick_MouseMove(ByVal sender As System.Object, ByVal e As
> System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
>
> ' You can use e.x here as this will have the coordinates as well and do[/color]
type[color=blue]
> cast
> TextBox3.Text = e.x
> TextBox4.Text = e.y
>
> End Sub
>
> Hope this helps.
> rawCoder
>
> "Adriano" <adriano@tadaz.com> wrote in message
> news:uucJBMlXEHA.4000@TK2MSFTNGP09.phx.gbl...[color=green]
> > I'm a beginner so I used IDE to write the code,
> > here is the code:
> >
> > Private Sub FormClick_MouseMove(ByVal sender As System.Object, ByVal e[/color][/color]
As[color=blue][color=green]
> > System.EventArgs) Handles MyBase.MouseMove
> >
> > TextBox3.Text = Form1.MousePosition.X
> >
> > TextBox4.Text = Form1.MousePosition.Y
> >
> > End Sub
> >
> >
> >
> > "rawCoder" <rawCoder@hotmail.com> wrote in message
> > news:Ovu#LocXEHA.2408@tk2msftngp13.phx.gbl...[color=darkred]
> > > Did you use the IDE to get the signature of method .. like from top
> > > ComboBoxes by selecting Base and Overrides and then selecting[/color][/color][/color]
MouseMove[color=blue][color=green][color=darkred]
> > > method. Or did u write it yourself. If later is the case, do try it[/color][/color]
> using[color=green][color=darkred]
> > > the IDE. You may wanna post the Signture here so that the problem can[/color][/color][/color]
be[color=blue][color=green][color=darkred]
> > > identified.
> > >
> > > frankly I dont remember any signature.. not even Form_Load ... so[/color][/color][/color]
gotta[color=blue][color=green][color=darkred]
> > > trust the IDE. Thanx its not C# and the IDe is on our side;-)
> > >
> > > Thank You
> > > rawCoder
> > >
> > > "Adriano" <adriano@tadaz.com> wrote in message
> > > news:uAGKO%23aXEHA.2972@TK2MSFTNGP12.phx.gbl...
> > > > hello Coder,
> > > > I tried this but the following error message appears:
> > > >
> > > > Method 'FormClick_MouseMove' cannot handle Event 'MouseMove' because[/color]
> > they[color=darkred]
> > > do
> > > > not have the same signature.
> > > >
> > > > any other ideas?
> > > >
> > > > "rawCoder" <rawCoder@hotmail.com> wrote in message
> > > > news:Ol1x5cZXEHA.644@tk2msftngp13.phx.gbl...
> > > > > Hi Adriano,
> > > > >
> > > > > Try handling the MouseMove Event and in the event arguments you[/color][/color][/color]
will[color=blue][color=green]
> > be[color=darkred]
> > > > able
> > > > > to retrieve the Mouse Position Coordinates
> > > > > something like this
> > > > > Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As
> > > > > System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
> > > > >
> > > > > Debug.WriteLine(e.X & "," & e.Y)
> > > > >
> > > > > End Sub
> > > > >
> > > > > Hope it helps
> > > > > rawCoder
> > > > >
> > > > > "Adriano" <adriano@tadaz.com> wrote in message
> > > > > news:eRROj3YXEHA.1144@TK2MSFTNGP10.phx.gbl...
> > > > > > hello,
> > > > > >
> > > > > > is there any code to catch mouse move?
> > > > > > I mean to catch X and Y locations on a form?
> > > > > >
> > > > > > tnx in advance,
> > > > > > Adriano
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Closed Thread


Similar Visual Basic .NET bytes