PDA

Click to See Complete Forum and Search --> : strore and retrieve x,y position values


joey o.
Jan 12th, 2000, 12:07 AM
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?

Bob Baddeley
Jan 12th, 2000, 06:01 AM
In module:

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


in form:


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



That should give you the correct coordinates and put them in textboxes on the second form. Good luck,

bob

joey o.
Jan 15th, 2000, 10:36 AM
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