VB.Net - Call a Sub with events

前端 未结 3 1797
北恋
北恋 2021-01-27 05:35

Is it possible to Call a Sub with events?

I have the following sub, and when I press a button, I will trigger a Msgbox.

Public Class SelectLevel

    Pub         


        
3条回答
  •  走了就别回头了
    2021-01-27 05:44

    Your code is correct except in one place. While calling, you have to give the required parameters

    Your Sub Procedure is : Public Shared Sub Button_Start_Click(sender As Object, e As EventArgs) Handles Button_Start.Click

    But you're calling as :Call SelectLevel.Button_Start_Click (without any values to be sent)

    Call like this:

    Private Sub Testing()
        SelectLevel.Button_Start_Click(Button_Start, Nothing) ' I tried this aswell but didn't work.
    End Sub
    

    This will do your work

提交回复
热议问题