How do I fire an event in VB.NET code?

前端 未结 4 2009
心在旅途
心在旅途 2020-12-31 02:57

I have a form that has a start button (to allow users to run the processes over and over if they wish), and I want to send a btnStart.Click event when the form

4条回答
  •  天命终不由人
    2020-12-31 03:23

    You are trying to implement a bad idea. Actually, you have to make a subroutine to accomplish these kind of tasks.

    Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
    
          call SeparateSubroutine()
    
    End Sub
    
    private sub SeparateSubroutine()
    
       'Your code here.
    
    End Sub
    

    And then whereever you want to call the btnStart's click event, just call that SeparateSubroutine. This should be a correct way in your case.

提交回复
热议问题