Hello Geeks,
I am new (on the board and in programming) so please don't hit me too hard.
Unfortunately I have some problems with a TreeView which is used as a menu in my application. Based on my selection, i want to load the necessary UserControl into my form. The names of my menu items are like "Database", "Advanced", etc.
I created one UserControl for each menu item, which are named "ucDatabase", "ucAdvanced", etc. When i try something like this:
I get the following error message:Code:Me.pcRight.Controls.Add(GetControlByName(tvSettings.SelectedNode.Name)) Function GetControlByName(ByVal Name As String) As Control ' Set uc prefix Dim ucName As String = Name.Insert(0, "uc") Return ucName End Function
Value of type 'String' cannot be converted to System.Windows.Forms.Control'
So how can i convert my string to an user control object which can be loaded on my form?
Thanks for any input
voidpixels




.
Reply With Quote