Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
VB.Net: Create an instance of class from a string using reflection
From Wiki
I would not recommend having this in your code. But perhaps sometimes you really need this.
- Dim _asm As [Assembly]
- _asm = [Assembly].GetAssembly(GetType(System.Windows.Forms.Control))
- Dim obj As Control = asm.CreateInstance("System.Windows.Forms." & Me.ComboBox1.Text, True)
The Assembly should be the one containing the class you want to instantiate. The createinstance takes a String being the Fully Qualified Name of the class.



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.