Results 1 to 7 of 7

Thread: Problems getting custom object into a custom collection [Resolved]

  1. #1

    Thread Starter
    Addicted Member Porsche944's Avatar
    Join Date
    Apr 2005
    Location
    Ann Arbor
    Posts
    182

    Resolved Problems getting custom object into a custom collection [Resolved]

    I have a class called objLocate which stores information about various searches my program performs. I also have a custom class that works like a collection. Both of the classes work correctly because I have gotten my save previous searches to work correctly. I am trying to create a list box now loaded with some standard features that will be linked to the custom collection class I created by referecing the object through the item property.

    I am getting the error
    Additional information: Object reference not set to an instance of an object
    on the line
    Dim tempObject As objLocate = New objLocate(SearchFor.RegularExpression, desMachineType.HomeWorkstation, "MA-EA.*", enumSaveName.DellTag, enumSearchTab.Basic, enumUpdateHashTable.No)

    I have tried as new objLocate as well and I even tried the like that is commented out which is a function i created to create these objects from the class. I keep getting the same error.

    VB Code:
    1. lstDivisions.Items.Add("MA-EA")
    2.         Dim tempObject As objLocate = New objLocate(SearchFor.RegularExpression, desMachineType.HomeWorkstation, "MA-EA.*", enumSaveName.DellTag, enumSearchTab.Basic, enumUpdateHashTable.No)
    3.         'Dim tempObject As objLocate = LoadLookingForObject(enumSearchTab.Basic, enumPresetSearch.GX110)
    4.         preDivision.Add(tempObject)
    5.         tempObject = Nothing
    6.         lstDivisions.Items.Add("MA-FI")
    7.         Dim tempObject1 As New objLocate(SearchFor.RegularExpression, desMachineType.HomeWorkstation, "MA-FI.*", enumSaveName.DellTag, enumSearchTab.Basic, enumUpdateHashTable.No)
    8.         preDivision.Add(tempObject1)
    Last edited by Porsche944; Jun 15th, 2005 at 02:18 PM.

  2. #2
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: Problems getting custom object into a custom collection

    Do all parameter are enumeration ? or are they all instanciated ?

    Code:
    SearchFor.RegularExpression
    desMachineType.HomeWorkstation
    enumSaveName.DellTag
    enumSearchTab.Basic enumUpdateHashTable.No
    or probably the error is in the New Event of objLocate?
    Using VS 2010 on Fw4.0

  3. #3

    Thread Starter
    Addicted Member Porsche944's Avatar
    Join Date
    Apr 2005
    Location
    Ann Arbor
    Posts
    182

    Re: Problems getting custom object into a custom collection

    They are enumerations, I've never had problems creating objLocate objects from this class before.

    The error actually happens on this line

    preDivision.Add(tempObject)

  4. #4
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: Problems getting custom object into a custom collection

    and what is the definition of preDivision?

    Do it is Instantiated earlier ?
    Using VS 2010 on Fw4.0

  5. #5

    Thread Starter
    Addicted Member Porsche944's Avatar
    Join Date
    Apr 2005
    Location
    Ann Arbor
    Posts
    182

    Talking Re: Problems getting custom object into a custom collection

    Thanks for that response I found the problem was in the way I declared preDivision I forgot to ad as new on it. It's working now thats for your help.

    I am adding props to your replies.

  6. #6

    Thread Starter
    Addicted Member Porsche944's Avatar
    Join Date
    Apr 2005
    Location
    Ann Arbor
    Posts
    182

    Re: Problems getting custom object into a custom collection

    "You must spread some Reputation around before giving it to Zakary again."

    Looks like I already gave you props for helping me out on something else. I'll get you back in the future

  7. #7
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: Problems getting custom object into a custom collection [Resolved]

    Happy to help body !!
    Using VS 2010 on Fw4.0

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