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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting form XY Coordinates in response to User Clicks

Status
Not open for further replies.

Cognac

Technical User
Joined
Oct 12, 2004
Messages
1
Location
US
Using VB5 how can I tell where a user has clicked on a form?
When i put statements under form doubleclick, to see
what me.currentX and me.currentY are, I get no response.
 
I get 0's??

However, I have a work around, in the absence of the correct way to do this. Create a new project with one form and add the following code to the form module:

Option Explicit
Dim CurrX As Single
Dim CurrY As Single

Private Sub Form_Click()
MsgBox CurrX
MsgBox CurrY
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
CurrX = X
CurrY = Y
End Sub


Run the project and click on the form.

Simon
 

Private Sub Form_MouseDown (Button As Integer, _
Shift As Integer, X As Single, Y As Single)
CurrentX = X
CurrentY = Y
MsgBox " X = " & CurrentX & ", Y = " & CurrentY
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top