473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Mouse location

hello,

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

tnx in advance,
Adriano
Nov 20 '05 #1
7 1864
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" <ad*****@tadaz.com> wrote in message
news:eR**************@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

Nov 20 '05 #2
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" <ra******@hotmail.com> wrote in message
news:Ol*************@tk2msftngp13.phx.gbl...
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" <ad*****@tadaz.com> wrote in message
news:eR**************@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


Nov 20 '05 #3
* "rawCoder" <ra******@hotmail.com> scripsit:
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


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

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
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" <ad*****@tadaz.com> wrote in message
news:uA****************@TK2MSFTNGP12.phx.gbl...
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" <ra******@hotmail.com> wrote in message
news:Ol*************@tk2msftngp13.phx.gbl...
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" <ad*****@tadaz.com> wrote in message
news:eR**************@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



Nov 20 '05 #5
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" <ra******@hotmail.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
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" <ad*****@tadaz.com> wrote in message
news:uA****************@TK2MSFTNGP12.phx.gbl...
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" <ra******@hotmail.com> wrote in message
news:Ol*************@tk2msftngp13.phx.gbl...
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" <ad*****@tadaz.com> wrote in message
news:eR**************@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
>
>



Nov 20 '05 #6
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" <ad*****@tadaz.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
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" <ra******@hotmail.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
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" <ad*****@tadaz.com> wrote in message
news:uA****************@TK2MSFTNGP12.phx.gbl...
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" <ra******@hotmail.com> wrote in message
news:Ol*************@tk2msftngp13.phx.gbl...
> 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" <ad*****@tadaz.com> wrote in message
> news:eR**************@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
> >
> >
>
>



Nov 20 '05 #7
now it works fine!!!
i appreciate your time and help,

Adriano

"rawCoder" <ra******@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
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" <ad*****@tadaz.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
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" <ra******@hotmail.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
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" <ad*****@tadaz.com> wrote in message
news:uA****************@TK2MSFTNGP12.phx.gbl...
> 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" <ra******@hotmail.com> wrote in message
> news:Ol*************@tk2msftngp13.phx.gbl...
> > 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" <ad*****@tadaz.com> wrote in message
> > news:eR**************@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
> > >
> > >
> >
> >
>
>



Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jay | last post by:
I need to be able to move a Panel on a windows Form at run time using the mouse. I have tried adding a MouseDown event handler to the Panel and then within the MouseDown handler adding a MouseMove...
2
by: Robin Senior | last post by:
Hi, I'm trying to drag and drop onto a Panel on my form. The panel is inside a groupBox, which of course is inside my form. When dropping the item onto my Panel, I want it to appear at that...
4
by: Raj Chudasama | last post by:
I have a controls similiar to the windows calculator. (Please press some buttons on your calculator to see what i am talking about) So when u hover over a button it will change the state (it...
5
by: Charles Law | last post by:
Sorry for reposting this question, but I did not get a single answer last time, and I'm sure you guys must have some thoughts on the matter. I have a user control which can be dragged and dropped...
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
13
by: Lars Netzel | last post by:
Hi! I have a round area which I want to be able to move the mouse over and fire off events... how do I do that? I have drawn a FillPie Graphics and I feel that there has to be a way of...
2
by: Sam | last post by:
Hi, I can't figure out how to detect when my mouse cursor leaves a panel control. It should not trigger the event (or do anything) when the mouse leave the panel but still is over a control that...
1
by: beatsoup | last post by:
Is there a way to find out the location of the mouse when an event object is not handy? For example, let's say I want to wake up in 1 second and check where the mouse is. The function called by the...
2
by: quickcur | last post by:
Hi, I have html like this: <div id="myCanvas" style="border:10px, black;position:relative;height:250px;width:100%;"> <img id="p" src="p.jpg"> </div> When user click the mosue, I would like ...
5
by: EggHead | last post by:
Hi all, My development environment is VB 6.0, and my OS is winxp. I would like to know how to find the mouse location at a control when the mouse is point at that control. The problem is that the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.