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=loadmebyname("myclassfilename.dll","myclass",n othing)
obj.functionname
Hope this helps.. function follows:
Regards
Simon
Public Shared Function LoadMeByName(ByVal vstrAssemblyName 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.Assembly
Dim objtemp As Object
Dim Params() As Object
'MsgBox(Application.StartupPath)
Try
If Dir(Application.StartupPath & "\" & vstrAssemblyName).Equals("") Then
Err.Raise(-1, "LoadMeByName", "assembly could not found, wrong assembly name
given ")
Exit Function
End If
objAssembly = objAssembly.LoadFrom(Application.StartupPath & "\" &
vstrAssemblyName)
objtemp = objAssembly.CreateInstance(vstrClassName, True,
Reflection.BindingFlags.CreateInstance, Nothing, vArgs, Nothing, Nothing)
If objtemp Is Nothing Then
Err.Raise(-1, "LoadMeByName", "assembly could not found, wrong assembly name
given ")
Exit Function
End If
' LoadMeByName = objtemp
Return objtemp
Catch
End Try
End Function
<sa********@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.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