View all Assembly Form Type in a Tree : Assembly « Reflection « VB.Net






View all Assembly Form Type in a Tree

View all Assembly Form Type in a Tree
  
Imports System
Imports System.Drawing
Imports System.Reflection
Imports System.Windows.Forms

public class MainClass

   Shared Sub Main()
      Dim form1 As Form = New Form1
      Application.Run(form1)
   End Sub

End Class



Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents treeView1 As System.Windows.Forms.TreeView

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.treeView1 = New System.Windows.Forms.TreeView()
        Me.SuspendLayout()
        '
        'treeView1
        '
        Me.treeView1.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.treeView1.ImageIndex = -1
        Me.treeView1.Location = New System.Drawing.Point(8, 16)
        Me.treeView1.Name = "treeView1"
        Me.treeView1.SelectedImageIndex = -1
        Me.treeView1.Size = New System.Drawing.Size(448, 200)
        Me.treeView1.Sorted = True
        Me.treeView1.TabIndex = 0
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(467, 248)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.treeView1})
        Me.Name = "Form1"
        Me.Text = "View Direct Members of Objects"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Function StripType(ByVal s As String) As String
        Dim spacepos As Integer
        spacepos = InStr(s, " ")
        If spacepos > 0 Then Return Mid$(s, spacepos + 1)
        Return (s)
    End Function

    Private Sub Form1_Load(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles Me.Load

        Dim asm As [Assembly]
        Dim asmtypes() As Type
        Dim ThisType As Type
        asm = Reflection.Assembly.GetAssembly(GetType(System.Windows.Forms.Form))
        asmtypes = asm.GetTypes()
        For Each ThisType In asmtypes
            If ThisType.IsClass Then
                Dim tn As New TreeNode(ThisType.Name)
                treeView1.Nodes.Add(tn)
            End If
        Next
    End Sub


End Class

           
         
    
  








Related examples in the same category

1.Add all Public Assembly Form TypeAdd all Public Assembly Form Type
2.View all Assembly Form Type and its members in a Tree
3.Find Members with Binding FlagsFind Members with Binding Flags
4.Get Assembly Member type: Property or Member Get Assembly Member type: Property or Member
5.Load all Types in one AssemblyLoad all Types in one Assembly
6.Get Class Name in Current AssemblyGet Class Name in Current Assembly
7.Get Executing AssemblyGet Executing Assembly
8.Get Information from AssemblyGet Information from Assembly
9.Get info for current AppDomain
10.Hook into DomainUnload event
11.Programmatically make a new app domain
12.Assembly Class represents an assembly
13.The AssemblyName type can be used to parse the full name
14.Create an object from the assembly, passing in the correct number and type of arguments for the constructor
15.Get the version of the executing assembly (that is, this assembly).
16.Get the version of the current application.
17.Get the version of a specific assembly.
18.Using AssemblyVersionAttribute
19.Create AssemblyName class with the specified display name.
20.AssemblyName.GetAssemblyName gets the AssemblyName for a given file.
21.AssemblyName.Version gets or sets the major, minor, build, and revision numbers of the assembly.
22.Assembly.FullName gets the display name of the assembly.
23.Assembly.GetCallingAssembly returns the Assembly of the method that invoked the currently executing method.
24.Assembly.GetExecutingAssembly gets the assembly that contains the code that is currently executing.
25.Assembly.GetExportedTypes gets the public types defined in this assembly that are visible outside the assembly.
26.Assembly.GetTypes gets the types defined in this assembly.
27.Assembly.IsDefined tells whether or not a specified attribute has been applied to the assembly.
28.Assembly.Load loads an assembly given the long form of its name.
29.Assembly.Location Property gets the path or UNC location of the loaded file that contains the manifest.
30.The version of mscorlib.dll