Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Leigh on Sea, Essex, England
    Posts
    263
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have three classes in a project: "StopPoint" contains a list of bus stops together with geocodes; "RouteLink" describes a route between two StopPoint objects referred to by the StopPoint ID at each end of the link; and "Service" which is a public transport service containing a collection of StopPoints and a collection of RouteLinks.

    The RouteLink class has a property, LinkDistance, which is read only and is calculated from the geocodes of the two StopPoints.

    What I am finding that I have to do is to store the geocodes of the StopPoints as part of the RouteLink in order to calculate the LinkDistance. This is because my class (or collection - not sure which) doesn't seem to let me define a Parent method to return the Service class, which would allow me to refer back to the StopPoint collection. This leaves me having to store at least some of the the StopPoint information twice, which is unhelpful and inefficient. I've scratched my head, but I can't see a sensible way to get around it. Can anyone help, please.

    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I apologize, I fear that your question won't get many replies here - the Lounge focuses on VBA within the Office applications. You may have better luck in one of the VB developer newsgroups.

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    What exactly do you mean when you say you can't define a Parent for the RouteLink? Also, wouldn't it be easier to assign a start and stop StopPoint object as properties of the RouteLink?
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Leigh on Sea, Essex, England
    Posts
    263
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='rory' post='787622' date='05-Aug-2009 11:11']What exactly do you mean when you say you can't define a Parent for the RouteLink? Also, wouldn't it be easier to assign a start and stop StopPoint object as properties of the RouteLink?[/quote]

    Yes. I realised eventually that that was all that I needed to do. I'm now revising my code to make it work properly! Thanks for the suggestion.

    As to the other reply, thanks - but actually I'm writing it inside Excel. It's simply a part of other functions that I carry out with VBA to manage a complex data set. Perhaps in time I'll port it to VB, but not yet.

    Regards,
    Stuart

Posting Permissions

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