Need help on creating a custom object

Posted on 2003-03-04
Medium Priority
Last Modified: 2012-05-04
I'm not familiar with class. I want to creat a MAP object like following,

map.lines(3).points(5).x  'means the X coordinate for the 5th point of the 3rd line of the map

map.lines(3).points(5).y  'means the Y coordinate for the 5th point of the 3rd line of the map

map.lines(1).color  'means the 1st line's color

Could anyone can help me to creat it?

Thanks a lot!
Question by:Jerryleo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

marconovaro earned 200 total points
ID: 8063294

You'll have to create a class Point, with a property X and Y:

property get X() as long
    X = m_myX
end property

property let X(value as long)
    m_myX = value
end property

Then, you create a class line, that contains a collection of points:

private m_PointsColl as Collection

Private Sub Class_Initialize()
   set m_PointsColl = new Collection
End Sub

Private Sub Class_Terminate()
   set m_PointsColl = Nothing
End Sub

property Get Points( itemNum as long ) as cPoint
   set Points = PointsColl(itemNum)
end property

then, you can create your map, that contains a collection of lines.


Author Comment

ID: 8102281
Thank you very much indeed for your kind help

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question