How do I link up a button click event between a class and a module automatically?

Posted by CowKingDeluxe on Stack Overflow See other posts from Stack Overflow or by CowKingDeluxe
Published on 2010-05-02T20:13:28Z Indexed on 2010/05/02 20:17 UTC
Read the original article Hit count: 159

Filed under:
|
|
|

I have this code (which doesn't work):

Public Class Form1

End Class

Public Module test1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Form1.Button1.Click
        MsgBox("HI")
    End Sub
End Module 

I know I could handle the button click event in Form1, and then call a function in test1, but I would like to handle the button click event directly in the test1 module. Is there a way to automatically send UI events from the Form1 class to another module?

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about visual-basic