I think you need to use reflection for this..
I do something similar, using an XML based menu structure with each menu
loading a dll and calling a function... The function may in turn load a
form.
This is done using the following function which is called such as follows:
obj=loadmebynam e("myclassfilen ame.dll","mycla ss",nothing)
obj.functionnam e
Hope this helps.. function follows:
Regards
Simon
Public Shared Function LoadMeByName(By Val vstrAssemblyNam e As String, ByVal
vstrClassName As String, ByVal vArgs() As Object) As Object
'************** *************** *************** *************** *************** **********
'dynamically load object from assembly for late binding purpose
'
*************** *************** *************** *************** *************** **********
Dim objAssembly As Reflection.Asse mbly
Dim objtemp As Object
Dim Params() As Object
'MsgBox(Applica tion.StartupPat h)
Try
If Dir(Application .StartupPath & "\" & vstrAssemblyNam e).Equals("") Then
Err.Raise(-1, "LoadMeByNa me", "assembly could not found, wrong assembly name
given ")
Exit Function
End If
objAssembly = objAssembly.Loa dFrom(Applicati on.StartupPath & "\" &
vstrAssemblyNam e)
objtemp = objAssembly.Cre ateInstance(vst rClassName, True,
Reflection.Bind ingFlags.Create Instance, Nothing, vArgs, Nothing, Nothing)
If objtemp Is Nothing Then
Err.Raise(-1, "LoadMeByNa me", "assembly could not found, wrong assembly name
given ")
Exit Function
End If
' LoadMeByName = objtemp
Return objtemp
Catch
End Try
End Function
<sa********@gma il.com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
Hello:
Here is the situation. VB.NET
I have several forms and I have a XML file that can start with a
particular for for debugging/layout reasons. This is a mdi project.
Normaly you would load a form as follows:
Dim frmT As frmTrans
frmT = New frmTrans
frmT.formDate = Now.Date
frmT.MdiParent = Me
frmT.Show()
Thus you could have a menu option to kick off a child form. What I
need is a way to have the form class as a varible name. Such as:
dim f as string = "frmTrans"
Dim frmT As f
frmT = New frmTrans
frmT.formDate = Now.Date
frmT.MdiParent = Me
frmT.Show()
Is there a way of doing this?
Thanks,
Sal
sfp04212005