G
Guest
Is there are equivalent activity in .NET Windows to
MyControl =LoadControl("NamedContol.ascx") ?
I need “loadâ€, add to a ControlsCollection a particular UserControl based on a run-time XML stream. For example by picking off attribute: UseVisualControl=â€SomeUserControlâ€
There will be 100’s of such UserControls available for the stream to request.
From this static, design-time snippet:
Dim MyUserContol As SomeUserControl = New SomeUserControl
Me.Panel1.Controls.Add(MyUserContol)
How can I do this dynamically, creating the requested â€SomeUserControl†on the fly WITHOUT a gigantic case statement:
Select Case UseVisualControl
Case “AUserControlâ€
Dim MyUserContol As AUserControl = New AUserControl
Me.Panel1.Controls.Add(MyUserContol)
Case “BUserControl†…
Dim MyUserContol As BUserControl = New BUserControl
Me.Panel1.Controls.Add(MyUserContol)
Case “CUserControl …
Dim MyUserContol As CUserControl = New CUserControl
Me.Panel1.Controls.Add(MyUserContol)
Beyond this … I would like to be able to catalog the UserControls available as part of the XML editing / creation. Speaking to the user … For this node, here is a list of UserControls you can select from (to set UseVisualControl=â€SomeUserControlâ€). Is there a way to catalog them programmatically?
Regards,
John
MyControl =LoadControl("NamedContol.ascx") ?
I need “loadâ€, add to a ControlsCollection a particular UserControl based on a run-time XML stream. For example by picking off attribute: UseVisualControl=â€SomeUserControlâ€
There will be 100’s of such UserControls available for the stream to request.
From this static, design-time snippet:
Dim MyUserContol As SomeUserControl = New SomeUserControl
Me.Panel1.Controls.Add(MyUserContol)
How can I do this dynamically, creating the requested â€SomeUserControl†on the fly WITHOUT a gigantic case statement:
Select Case UseVisualControl
Case “AUserControlâ€
Dim MyUserContol As AUserControl = New AUserControl
Me.Panel1.Controls.Add(MyUserContol)
Case “BUserControl†…
Dim MyUserContol As BUserControl = New BUserControl
Me.Panel1.Controls.Add(MyUserContol)
Case “CUserControl …
Dim MyUserContol As CUserControl = New CUserControl
Me.Panel1.Controls.Add(MyUserContol)
Beyond this … I would like to be able to catalog the UserControls available as part of the XML editing / creation. Speaking to the user … For this node, here is a list of UserControls you can select from (to set UseVisualControl=â€SomeUserControlâ€). Is there a way to catalog them programmatically?
Regards,
John