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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim asm As [Assembly] =
[Assembly].LoadFrom("c:\t est\ClassLibrar y1\bin\ClassLib rary1.dll")
Dim types() As Type = asm.GetTypes()
For i As Integer = 0 To types.Length - 1
If types(i).BaseTy pe Is GetType(System. Windows.Forms.F orm) Then
Debug.WriteLine (types(i).Name)
Dim o As Object = Activator.Creat eInstance(types (i),
BindingFlags.Cr eateInstance, 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.