Loading sub from another sub

Simon Scott 306 Reputation points
2022-02-07T12:09:54.07+00:00

Good afternoon,

I have a really simple question which i cannot work out.

I'm trying to call a private sub from another private sub which are in the same class but get an error.

This is the sub i'm trying to call...Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

This is the code i'm typing in which gives me an error..... Timer1_Tick()

Sorry for the silly question, my VB.net skills are fairly basic.

Thanks
Simon

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,595 questions
0 comments No comments
{count} votes

Accepted answer
  1. Karen Payne MVP 35,196 Reputation points
    2022-02-07T12:18:13.833+00:00

    Either invoke the Start method or use Timer1_Tick(Nothing, Nothing) were generally speaking one does not use the parameters.

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Console.WriteLine(Now)
    End Sub
    
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Timer1_Tick(Nothing, Nothing)
    End Sub
    

0 additional answers

Sort by: Most helpful