Results 1 to 3 of 3

Thread: X,Y coordinates in array

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    10

    X,Y coordinates in array

    i am looking for a way to store x,y coordinates in a array. I need to be able to recall the x and y seperatly later in the program.

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: X,Y coordinates in array

    Just store the point in an array of points...
    VB Code:
    1. Dim MyPoints(1) As Point
    2.         MyPoints(0) = New Point(5, 10)
    3.         MyPoints(1) = New Point(15, 20)
    4.         MessageBox.Show(MyPoints(0).X.ToString) 'x value of 1st item
    5.         MessageBox.Show(MyPoints(1).X.ToString) 'x value of 2nd item
    Or you can use an arraylist and add the point to it so you can just add the items on the fly. Then just cast the object in the arraylist to a point in order to access its properties.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: X,Y coordinates in array

    If this is VB 2005 and you want an easily resizable collection then use a List(Of Point). An ArrayList is so 2003 Gig.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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