A
Antony
Hello - I am wanting to print out a "Yes" next to classes that
implement "Interface01", otherwise a "No". Here is my code. It crashes
with a null reference exception and I am not sure why. Ideas?
Thank you for you help.
Tony
Imports System.Reflection
Public Class Form1
Inherits System.Windows.Forms.Form
''Windows Form Designer generated code
Interface Interface01
End Interface
MustInherit Class Abstract01
End Class
Class Class01
Implements Interface01
End Class
Class Class02
End Class
Class Class03
Inherits Class01
End Class
Class ClassA2
Inherits Abstract01
End Class
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim asmbly As [Assembly] = [Assembly].GetExecutingAssembly()
Dim asmblyType As Type
For Each asmblyType In asmbly.GetTypes
If asmblyType.BaseType.Equals(GetType(Interface01)) Then
Debug.Write("Yes: ")
Else : Debug.Write("No: ")
End If
Debug.WriteLine(asmblyType.FullName)
Next
End Sub
End Class
implement "Interface01", otherwise a "No". Here is my code. It crashes
with a null reference exception and I am not sure why. Ideas?
Thank you for you help.
Tony
Imports System.Reflection
Public Class Form1
Inherits System.Windows.Forms.Form
''Windows Form Designer generated code
Interface Interface01
End Interface
MustInherit Class Abstract01
End Class
Class Class01
Implements Interface01
End Class
Class Class02
End Class
Class Class03
Inherits Class01
End Class
Class ClassA2
Inherits Abstract01
End Class
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim asmbly As [Assembly] = [Assembly].GetExecutingAssembly()
Dim asmblyType As Type
For Each asmblyType In asmbly.GetTypes
If asmblyType.BaseType.Equals(GetType(Interface01)) Then
Debug.Write("Yes: ")
Else : Debug.Write("No: ")
End If
Debug.WriteLine(asmblyType.FullName)
Next
End Sub
End Class