By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

Instantiate a class from a variable's contents

P: n/a
If a string variable contains a value that is the name of a class, is there
any way to instantiate the class from the contents?
Example:
Dim strClassName as String = "Foo"
Dim cls as New strClassName

Thanks,
Dean Slindee
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You could use Activator.CreateInstance.

http://groups.google.com/groups?th=9533141b05748d23
hope that helps..
Imran.

"Dean Slindee" <sl*****@charter.net> wrote in message
news:10*************@corp.supernews.com...
If a string variable contains a value that is the name of a class, is
there
any way to instantiate the class from the contents?
Example:
Dim strClassName as String = "Foo"
Dim cls as New strClassName

Thanks,
Dean Slindee

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.