M
mayetski
Hello!
I have this kind of code before:
Select Case iSelected
Case 1
obj = New CompanyCollection
Case 2
obj = New ApplicationHostedCollection
End Select
A certain object is created depending on the selected number. However,
I would need to put the object names into a database, so
CompanyCollection and ApplicationHostedCollection is now saved in the
DB and accessed as a string value.
Im not sure how to create an instance of an object if the object name
to be created is a string variable.
I tried this but its not working
Dim strobj As String
strobj = "NPRG.Corelib.CompanyCollection, NPRG.Corelib"
Dim s As System.Type
s = Type.GetType(strobj, True)
Dim obj As Object
obj = Activator.CreateInstance(s)
The Type.GetType returns nothing so I cant move on. Am I doing
something wrong?
Please anyone help.
Thank you very much!
Mayet
I have this kind of code before:
Select Case iSelected
Case 1
obj = New CompanyCollection
Case 2
obj = New ApplicationHostedCollection
End Select
A certain object is created depending on the selected number. However,
I would need to put the object names into a database, so
CompanyCollection and ApplicationHostedCollection is now saved in the
DB and accessed as a string value.
Im not sure how to create an instance of an object if the object name
to be created is a string variable.
I tried this but its not working
Dim strobj As String
strobj = "NPRG.Corelib.CompanyCollection, NPRG.Corelib"
Dim s As System.Type
s = Type.GetType(strobj, True)
Dim obj As Object
obj = Activator.CreateInstance(s)
The Type.GetType returns nothing so I cant move on. Am I doing
something wrong?
Please anyone help.
Thank you very much!
Mayet