Dave,
You could use a switch, but in reality, you will want to look at the
static GetType method on the Type class. With this, assuming you have a
fully qualified type name, you can get the type that you have stored in the
database. Then, you can pass that Type instance to the static
CreateInstance method on the Activator class, and it will return an instance
of that type.
This assumes that they all have the same constructor of course
(parameterless, or same number/type of arguments).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"DaveD" <de****@noemail.noemailwrote in message
news:u2********************************@4ax.com...
OK, this may be simple, but...
I have a 5 classes, they all bring up a form to edit a table, and
they're all derivied from a virtual class. The user is allowed to pick
a table to edit from a drop-down list that was populated from a SQL
table, this table also contains the name of the class that is used to
edit it. Can I use 1 new statment to create the correct object or do I
have to use a switch?
Thanks,
Dave