CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Location
    VB .Net 2008
    Posts
    4

    [RESOLVED] List of Lists?

    I'm trying to make a list of flight plans loaded into my program, with each flight plan having a list of waypoints along the route, along with a few other properties associated with the flight plan. Each waypoint has its own associated properties, i.e. waypoint ID, waypoint type, location, etc.

    Here's the declarations:

    Code:
     Public Class WPinfo
            Public WPType As String
            Public WPID As String
            Public WPName As String
            Public WPAltitude As Integer
        End Class
     Public Class FlightPlan
            Public FileName As String
            Public Waypoints As List(Of WPinfo)
     End Class
    
        Public FlightPlans As List(Of FlightPlan)
    How do I implement the List methods to access the list elements, and add, remove, etc? The way I'm doing it now just gets me an 'Object reference not set to an instance of an object' error during runtime.

    Thanks!

  2. #2
    Join Date
    Nov 2009
    Location
    VB .Net 2008
    Posts
    4

    Re: List of Lists?

    Solved this one myself...

  3. #3
    Join Date
    Jul 2009
    Location
    Kuwait
    Posts
    170

    Re: [RESOLVED] List of Lists?

    Wat was the problem and how you resolved it?

  4. #4
    Join Date
    Nov 2009
    Location
    VB .Net 2008
    Posts
    4

    Re: [RESOLVED] List of Lists?

    I created a single new instance of my WPInfo called 'thisWP'. Every time I loaded in a waypoint, I put my converted info into thisWP, and then added thisWP to my waypoint list using the Add() method once I was done processing the info for the current waypoint. I am able to reference my flight plans and their waypoints using index references in the lists once I've actually added items to them. I kept trying to reference my lists and set values in them as if they were arrays before I had 'added' anything to them, which doesn't work.

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

Featured