View all Assembly Form Type and its members in a Tree : Assembly « Development « VB.Net

VB.Net
1. 2D
2. Application
3. Class
4. Data Structure
5. Database ADO.net
6. Development
7. Event
8. File Directory
9. Generics
10. GUI
11. Language Basics
12. Network Remote
13. Thread
14. Windows System
15. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net Tutorial
VB.Net » Development » AssemblyScreenshots 
View all Assembly Form Type and its members 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 NothingThen
                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(816)
        Me.treeView1.Name = "treeView1"
        Me.treeView1.SelectedImageIndex = -1
        Me.treeView1.Size = New System.Drawing.Size(448200)
        Me.treeView1.Sorted = True
        Me.treeView1.TabIndex = 0
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(467248)
        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 StringAs String
        Dim spacepos As Integer
        spacepos = InStr(s, " ")
        If spacepos > Then Return Mid$(s, spacepos + 1)
        Return (s)
    End Function

    Private Sub Form1_Load(ByVal sender As Object, _
        ByVal e As System.EventArgsHandles 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)
                Dim members(), mi As MemberInfo
                treeView1.Nodes.Add(tn)
                members = ThisType.GetMembers(BindingFlags.DeclaredOnly Or BindingFlags.Public Or BindingFlags.Instance Or BindingFlags.Static)
                For Each mi In members
                    Dim methinfo As MethodInfo
                    Select Case mi.MemberType
                        Case MemberTypes.Method
                            methinfo = CType(mi, MethodInfo)
                            If Not methinfo.IsSpecialName Then
                                tn.Nodes.Add(StripType(mi.ToString))
                            End If
                        Case MemberTypes.Event
                            tn.Nodes.Add(StripType(mi.ToString" event")
                        Case Else
                            tn.Nodes.Add(StripType(mi.ToString))
                    End Select
                Next
            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 in a TreeView all Assembly Form Type 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
ww__w___.__j___a__va___2__s_.___c_o_m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.