Ok I have a class that I want to handle it's own events but still have the instance inherit it.

for instance I want the event to display in a text box but from class level.

Make sense?

Here's my code:

vb.net Code:
  1. Private Sub InitializeHandlers()
  2.         AddHandler Me.OnConnectionEvent, AddressOf OnConnection
  3.         'AddHandler Me.OnAuthentication, AddressOf OnAuthenticated
  4.     End Sub
  5.  
  6.     Public Function OnConnection(ByVal sender As Object, ByVal e As ConnectionEventArgs)
  7.  
  8.         Return e.ConnectionData & vbCrLf
  9.  
  10.     End Function
  11.  
  12.     Public Sub Connect()
  13.         clientSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
  14.         Dim endpoint As IPEndPoint = New IPEndPoint(Dns.GetHostEntry(_remoteHostIP).AddressList(0), _remotePort)
  15.  
  16.         Try
  17.  
  18.             clientSocket.Connect(endpoint)
  19.             If clientSocket.Connected = True Then
  20.                 RaiseEvent OnConnectionEvent(Me, New ConnectionEventArgs(True))
  21.             End If
  22.         Catch ex As SocketException
  23.             RaiseEvent OnConnectionEvent(Me, New ConnectionEventArgs(False, ex.Message))
  24.             'Console.Write(ex.Message)
  25.         End Try
  26.  
  27.     End Sub
  28.  
  29. Public Class ConnectionEventArgs
  30.     Inherits TcpEventArgs
  31.  
  32. #Region "Decelartions"
  33.  
  34.     Private _connected As Boolean
  35.     Private _data As String
  36.  
  37. #End Region
  38.  
  39. #Region "Constructors"
  40.  
  41.     Public Sub New(ByVal connected As Boolean)
  42.         MyBase.New(-1, "")
  43.         _connected = connected
  44.     End Sub
  45.  
  46.     Public Sub New(ByVal connected As Boolean, ByVal data As String)
  47.         MyBase.New(-1, "")
  48.         _connected = connected
  49.         _data = data
  50.     End Sub
  51.  
  52. #End Region
  53.  
  54. #Region "Properties"
  55.  
  56.     Public ReadOnly Property Connected() As Boolean
  57.         Get
  58.             Return _connected
  59.         End Get
  60.     End Property
  61.  
  62.     Public ReadOnly Property ConnectionData() As String
  63.         Get
  64.             Return _data
  65.         End Get
  66.     End Property
  67.  
  68. #End Region
  69.  
  70. End Class