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:
lstDivisions.Items.Add("MA-EA")
Dim tempObject As objLocate = New objLocate(SearchFor.RegularExpression, desMachineType.HomeWorkstation, "MA-EA.*", enumSaveName.DellTag, enumSearchTab.Basic, enumUpdateHashTable.No)
'Dim tempObject As objLocate = LoadLookingForObject(enumSearchTab.Basic, enumPresetSearch.GX110)
preDivision.Add(tempObject)
tempObject = Nothing
lstDivisions.Items.Add("MA-FI")
Dim tempObject1 As New objLocate(SearchFor.RegularExpression, desMachineType.HomeWorkstation, "MA-FI.*", enumSaveName.DellTag, enumSearchTab.Basic, enumUpdateHashTable.No)
preDivision.Add(tempObject1)
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?
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)
Re: Problems getting custom object into a custom collection
and what is the definition of preDivision?
Do it is Instantiated earlier ?
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.
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 ;)
Re: Problems getting custom object into a custom collection [Resolved]