I can not test ir right now but if i remember correctly, java object has an initialize method that would allow you to create an object with a string. Or may be with the reflection library.
Sub CreateInstance (Name As String) As Object
Select Name
Case "Dave"
Dim d As Dave
d.Initialize
Return d
Case "David"
Dim dd As David
dd.Initialize
Return dd
End Select
End Sub
@Enrique Gonzalez R - interesting - without the underscore I get Method not found, with the underscore I get Method not matched. Not sure what the difference is. I've tried every combination of upper & lower case; all lowercase is the only thing that seems to even hint at working. I know I pasted the mixed case example but I am actually using lower. Will investigate jdgui...
@Daestrum - I don't necessarily know at design time which class I want to instantiate.
@Erel - that's pretty much what I'm doing as a work around.If that's the only way then that's fine.
Perfect.
Silly thing is I was already using this technique to call a method defined in a variable within the same class. I just never made the connection to call it externally.