troubleshooting Question

Need Help With Event

Avatar of Basicfarmer
BasicfarmerFlag for United States of America asked on
Visual Basic.NETProgramming Languages-Other.NET Programming
2 Comments1 Solution259 ViewsLast Modified:
Experts, I am trying to learn about events. I have a class that I am using and I have run into something that i cant figure out. I cannot get the onConnected sub to show up when i instantiate the class. I also want the e.eventargs to have the value of the IPAddress. Can you please help me out here?
Public Class Class2

    Public Delegate Sub EventHandler(ByVal sender As Object, ByVal e As EventArgs)
    Public Event Connected As EventHandler
    Private intIndex As Integer
    Private strIP As String

    Public Property index As Integer
            Return intIndex
        End Get
        Set(value As Integer)
            intIndex = value
        End Set
    End Property

    Public Property ip As String
            Return strIP
        End Get
        Set(value As String)
            strIP = value
            onConnect(New ipPropertyChangedEventArgs(value))
        End Set
    End Property

    Protected Overridable Sub onConnect(e As ipPropertyChangedEventArgs)
        RaiseEvent Connected(Me, e)
    End Sub

    Public Class ipPropertyChangedEventArgs
        Inherits EventArgs
        Private ReadOnly _proposedValue As String
        Public ReadOnly Property ProposedValue() As String
                Return Me._proposedValue
            End Get
        End Property
        Public Sub New(ByVal proposedValue As String)
            Me._proposedValue = proposedValue
        End Sub
    End Class

End Class
Frank Helk

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros