Could anyone help me with a way to store the
x,y values of the positions clicked on a form and then pass these values to another form as x,y values?
Printable View
Could anyone help me with a way to store the
x,y values of the positions clicked on a form and then pass these values to another form as x,y values?
In module:
in form:Code:Option Explicit
Type POINTAPI 'Declare types
x As Long
y As Long
End Type
Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long 'Declare API
That should give you the correct coordinates and put them in textboxes on the second form. Good luck,Code:
Option Explicit
Dim z As POINTAPI 'Declare variable
Dim X
Dim Y
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
GetCursorPos z 'Get Co-ordinets
X = z.x 'Get x co-ordinets
Y = z.y 'Get y co-ordinets
Form2.Text1.Text = X ' sends X to a text box on the second form
Form2.Text2.Text = Y ' sends Y to a text box on the second form
End Sub
bob
Thanks Bob, I'm using the principle to save user defined arrays of points from one screen to the next. You guys are invaluable.
Thanks Again!
Joey O