Results 1 to 3 of 3

Thread: variable may not have been initialized??...

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    variable may not have been initialized??...

    I am trying to use a Collection, but when I try to compile, I get an error saying that the collection may not have been initialized at this line:

    colData.add("Hello");
    ^

    so how do I initialize a Collection?

    Thanks

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    How did you do it in your code?

    Code:
    Collection myCol = new Collection();
    I don't think that you can do this. I may be wrong but I believe that there's only three types of collections:

    Sets:
    • HashSet
    • TreeSet

    Lists:
    • Vector
    • Stack
    • LinkedList
    • ArrayList

    Maps:
    • HashTable
    • HashMap
    • WeakHashMap
    • TreeMap



    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Thanks. I got it to work.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

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