Results 1 to 3 of 3

Thread: strore and retrieve x,y position values

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Post

    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?

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    In module:
    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
    in form:
    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
    That should give you the correct coordinates and put them in textboxes on the second form. Good luck,

    bob

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width