Create a new thread in VB.NET

There’s two ways to do this;

  1. With the AddressOf operator to an existing method

    Sub MyBackgroundThread()
      Console.WriteLine("Hullo")
    End Sub
    

    And then create and start the thread with;

    Dim thread As New Thread(AddressOf MyBackgroundThread)
    thread.Start()
    
  2. Or as a lambda function.

    Dim thread as New Thread(
      Sub() 
        Console.WriteLine("Hullo")
      End Sub
    )
    thread.Start()
    

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)