Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code a mouse move??

Status
Not open for further replies.

eward1

Programmer
Feb 24, 2003
18
US
How can I move the mouse cursor to a given location on the screen. For instance, When the user presses a function key I want to move the mouse to the center of the current form.
Thanks in advance for an help.
 
Hi, for these types of questions I would suggest the object browser .....2 clicks and you would have found that the cursor had a property of .position as a system drawing point

here is a button that will move your cursor for you.

Code:
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Cursor.Position() = New System.Drawing.Point(400, 400)
    End Sub

hope that helps....and that you get a good grade on your homework.

Bassguy
 
Bassguy

1. He may not have VS.net
2. I was looking in the object browser myself trying to answer his question. I typed in "mouse" and all the properties seemed to be read only. So I pressed F1 and nothing leapt out at me. If you don't know that you are looking for "cursor", not "mouse", then you are stuck. That's the problem with a lot of MS help...

Anyway, good answer!



Mark [openup]
 
Sorry, I guess I am a little tired this morning. But this post was right next to a post for a list box with a checkbox and could it be done.....

It never occurred to me that someone would try to right the stuff in notepad.

and I whole heartedly agree that the Microsoft help is little help on most things...

sorry if I bruised any feelings

bassguy

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top