How Set A Class Property To True - AddHandler - Button Click ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CJames
    New Member
    • Mar 2015
    • 4

    How Set A Class Property To True - AddHandler - Button Click ?

    Vb.net – VStudio 2010 – Win 7

    FORM Class Project Named ‘Notify’
    With Reference to ZonesLib - Successful Build

    Code:
    Public Class Alarms
    
    Private Sub myAlarms_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load     
    End Sub
    
    ‘In code just below am trying to Set iSkip Property in ZonesLib.TimerProc to True using AddHandler event
    ‘The code runs but nothing happens… missing args?? something stupidly simple in my AddHandler code or event handler code ??
    
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
       AddHandler Button1.Click, AddressOf ZonesLib.TimerProc.SetSkip
       Me.Close()
    End Sub
    
    End Class

    Standard Class Project Named ‘ZonesLib’ - Successful Build

    Code:
    Public Class TimerProc
    
         Public Shared Sub SetSkip(sender As System.Object, e As System.EventArgs)
         	iSkip = True
         	MsgBox("Skip")
        End Sub
    
        Private Shared _iSkip As Boolean = False
        Public Shared Property iSkip() As Boolean
            Get
                iSkip = _iSkip
            End Get
            Set(ByVal value As Boolean)
                _iSkip = value
            End Set
        End Property
    
    End Class
    Attached Files
  • CJames
    New Member
    • Mar 2015
    • 4

    #2
    OK... Doh !!...

    I moved the AddHandler line of code to handle the Button1.click event into the form's Load event instead of having it in its own Button1.click Sub with an immediate Me.Close line of code...

    Since how could an addhandler 'listen' for a click event with the Form already closed...

    Works fine Now... Move along... nothin' to see or learn here.

    :o)

    CJ

    Comment

    Working...