Create a control using a string that contains the control's name

G

geweiss

I am a seasoned PL/B programmer but pretty new to programming in .NET
2.0.
I would like to create a control using the control name (a string).
Can this be done?

Here is the current logic:
====================
Public Shared Function GetControlByComponentID(ByVal
intComponentID As SecurityComponents, ByVal intClientID As Integer)
Dim ctlControl As DevExpress.XtraEditors.XtraUserControl =
Nothing

Try
Select Case intComponentID
Case enSC_ClientsManagement
ctlControl = New ctlClientList
Case enSC_ClientsMaster
ctlControl = New ctlClientEdit(intClientID)
'ctlClientList
Case enSC_ContractorSetUp
ctlControl = New ctlContractorList
Case enSC_FundsMaster
ctlControl = New ctlFundList
==============
The other 20 case statements are not shown.

I would like to change this function to pass in a string that contains
the controls name.
Something like:

==============
Public Shared Function GetControlByComponentID(ByVal
strComponentName As String, ByVal intClientID As Integer)
Dim ctlControl As DevExpress.XtraEditors.XtraUserControl =
Nothing

ctlControl = CreateControl(strComponentName)
Return ctlControl
End Function

==============

I know that is not the right syntax (I just kind of made up the
CreateControl function) but I hope it gets the idea across.

This routine is currently called when the user clicks an item in the
left navigation tree. It creates the control in the right panel.

Any ideas or subjections would be appreciated. Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top