I have UserControl named for example 'aaa'
then i have variable:
Dim a as String = "aaa"
Now, i declare
Dim uc as UserControl = new aaa
my question is, can i write declaration above using value of variable a like below
Dim uc as UserControl = new a
You can do this using reflection (in the System.Reflection) namespace. For instance:
Dim t As Type = Assembly.GetExecutingAssembly().GetType("namespace.aaa")
Dim o As Object = Activator.CreateInstance(t)
Notice that you will need the full type name, including the namespace, so you may need to concatenate that to your string, for instance:
Dim namespace As String = "MyNamespace"
Dim t As Type = Assembly.GetExecutingAssembly().GetType(namespace & "." & a)
Dim o As Object = Activator.CreateInstance(t)