Jason_deBono
Member
- Joined
- Jan 30, 2008
- Messages
- 5
- Programming Experience
- 3-5
Hi,
Is there a better way to create an Object from the contents of a String Variable.
I would like to remove the Select Case statement, cause I have to do a case for every possible control type.
*** CODE eg. ***
StrControlType = *SOME CONTROL TYPE*
Select Case StrControlType.ToUpper
Case Is = "Button".ToUpper
Dim objButton As New Button With {.Location = New Point(50, 50)}
Me.Controls.Add(objButton)
Case Is = "TextBox".ToUpper
Dim objTextBox As New TextBox With {.Location = New Point(50, 50)}
Me.Controls.Add(objTextBox)
End Select
Is there a better way to create an Object from the contents of a String Variable.
I would like to remove the Select Case statement, cause I have to do a case for every possible control type.

*** CODE eg. ***
StrControlType = *SOME CONTROL TYPE*
Select Case StrControlType.ToUpper
Case Is = "Button".ToUpper
Dim objButton As New Button With {.Location = New Point(50, 50)}
Me.Controls.Add(objButton)
Case Is = "TextBox".ToUpper
Dim objTextBox As New TextBox With {.Location = New Point(50, 50)}
Me.Controls.Add(objTextBox)
End Select