Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb_dotnet thread: Remoting / Reflection Problem


Message #1 by "Guy Harwood" <guy@h...> on Thu, 19 Dec 2002 13:51:57
Im writing the UI for an application based on business objects(CSLA), in 
the Winforms version of the UI i want to load a form given only the 
string name of it, such as "frmCompany"

using reflection i can get an objecthandle of my form like so....


Private function LoadForm(ByVal FormName as string) as boolean

Try
    Dim obj As System.Runtime.Remoting.ObjectHandle
    obj = System.Activator.CreateInstance( _
Reflection.Assembly.GetExecutingAssembly.ToString, FormName)



Catch ex As Exception

    MessageBox.Show(ex.ToString)
........

How do i now get the form reference?
And is this the most effective way to load my form from a string 
identifier?

Thanks in advance

Guy

  Return to Index