Imports System.Threading

Public Class ThreadTest

    Private MyThread1 As Thread

    Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
        Dim Stamper1 As New TimeStamper("c:\alive1.txt", statusLabel)
        MyThread1 = New Thread(AddressOf Stamper1.WriteRegularTimeStamp)
        MyThread1.IsBackground = True
        MyThread1.Start()
        cmdStart.Enabled = False
        cmdStop.Enabled = True
    End Sub

    
    Private Sub cmdStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStop.Click
        cmdStop.Enabled = False
        Try
            MyThread1.Abort()
        Catch Err As Exception
            MessageBox.Show(Err.Message)
        End Try
        cmdStart.Enabled = True
        statusLabel.Text = ""
    End Sub
End Class
