Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleDetermine where the user clicked on a form
Keywordsform, click, position
CategoriesTips and Tricks
 
The problem is the Click event handler does not tell you the coordinates where the user clicked. Use a form-level variable to save the coordinates in the MouseUp event handler. Then use those coordinates in the Click event handler.
 
Private Sub Form_MouseUp(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    ClickX = X
    ClickY = Y
End Sub

Private Sub Form_Click()
    MsgBox "Clicked (" & Format$(ClickX) & ", " & _
        Format$(ClickY) & ")"
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated