Hi Brian,
Yes, we can use the reflection to enumerate the form class in the assembly.
Here goes the code snippet.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim asm As [Assembly] =
[Assembly].LoadFrom("c:\test\ClassLibrary1\bin\ClassLibrary1 .dll")
Dim types() As Type = asm.GetTypes()
For i As Integer = 0 To types.Length - 1
If types(i).BaseType Is GetType(System.Windows.Forms.Form) Then
Debug.WriteLine(types(i).Name)
Dim o As Object = Activator.CreateInstance(types(i),
BindingFlags.CreateInstance, Nothing, New Object() {}, Nothing)
o.Show()
End If
Next
End Sub
You may have a try and let me know the result.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.