Handling a button click in a module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cainnech
    New Member
    • Nov 2007
    • 132

    Handling a button click in a module

    Hello guys,

    I'm trying to create a generic module that I can easily add to different projects if needed.

    It creates a menuitem but now I would like to handle the click event of that menu also in my module.

    but just adding this:
    Code:
    Public Sub mnuAboutSub_Click(Index As Integer)
     debug.print "About"
    End Sub
    doesn't do anything.
    Anybody have any idea how I can do this?

    Greets,
    Cainnech
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    You can't detect a Menu event in a module.
    Just put the code in the module and call the function from the MNU_Click event.
    like: add Text1 + Text2 to Text3:
    form=
    Code:
    Private Sub mnutest_Click()
       Text3.Text = Add_Text(Text1.Text, Text2.Text)
    End Sub
    Module=
    Code:
    Public Function Add_Text(INT1 As Integer, INT2 As Integer) As Integer
       Add_Text = INT1 + INT2
    End Function

    Comment

    • Cainnech
      New Member
      • Nov 2007
      • 132

      #3
      Thanks Guido for the answer, unfortunately, it was not that what I was hoping for :-)

      Comment

      • Guido Geurs
        Recognized Expert Contributor
        • Oct 2009
        • 767

        #4
        Is it possible to attach your code in Bytes?

        Comment

        Working...