Hi
This code is supposed to be a threading example that writes to a console but I can make it work, can you take a lok to see what I'm doing wrong? It doesn't error, it just doesn't do anything. The code is based on an example from Francesco Balena's book.
thanks
VB Code:
  1. Imports System.IO
  2. Imports System.Threading
  3.     Sub DoTheTask()
  4.         For i As Integer = 1 To 10
  5.             Console.WriteLine("Msg #{0} from the second thread", i)
  6.             Thread.Sleep(200)
  7.         Next
  8.     End Sub
  9.  
  10.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  11.         Dim t As New Thread(New ThreadStart(AddressOf DoTheTask))
  12.         t.Start()
  13.         For i As Integer = 1 To 10
  14.             Console.WriteLine("Msg #{0} from the main thread", i)
  15.             Thread.Sleep(200)
  16.         Next
  17.     End Sub