EventInfo Class : EventInfo « Reflection « VB.Net






EventInfo Class

 
Imports System
Imports System.Reflection
Imports System.Security
Imports Microsoft.VisualBasic

Class MyEventExample
    Public Shared Sub Main()
        Try

            Dim myBindingFlags As BindingFlags = BindingFlags.Instance Or BindingFlags.Public _
                                                 Or BindingFlags.NonPublic
            Dim myTypeBindingFlags As Type = GetType(System.Windows.Forms.Button)
            Dim myEventBindingFlags As EventInfo = myTypeBindingFlags.GetEvent("Click", myBindingFlags)
            If Not (myEventBindingFlags Is Nothing) Then
                Console.WriteLine(myEventBindingFlags.ToString())
            End If

        Catch e As Exception
            Console.WriteLine("The following exception was raised : {0}", e.Message)
        End Try
    End Sub 
End Class 

   
  








Related examples in the same category