Ciao a Tutti,
sto giocando un po' con la reflection e vorrei una mano a capirci un po' di più...
Allora sono riuscito a creare un'istanza,eseguire una mia dll e a passargli pure dei parametri mediante InvokeMember
ma dovrebbe esserci anche un altro modo, utilizzando le info presenti nel type, ma non capisco come...
Chi mi da una mano ?
Grazie
Try
Dim pAssemblyName As String = "...\WFDLL1.dll"
Dim asmb As Assembly = Assembly.LoadFrom(pAssemblyName)
For Each t As Type In asmb.GetTypes()
If t.BaseType.Equals(GetType(Form)) Then
If t.Name = "Form1" Then
Dim frm As Form = Nothing
frm = DirectCast(Activator.CreateInstance(t), Form)
Dim oParam As Object() = New Object(0) {}
oParam(0) = "Massimo" & DateTime.Now.ToLongTimeString
t.InvokeMember("Nome", BindingFlags.SetProperty, Nothing, frm, oParam)
frm.Show()
End If
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try