Sub ThreadCode
ErrorLabel(ThreadCodeErr1) ' if abort is used to stop a thread an (intended by .NET) error occurs when optimised compiled
Do While True ' do until aborted
' read the angle into a Global variable
Thread.FireThreadEvent ' update the reading
Thread1.Sleep(1000) ' sleep for required update period to avoid using resources
Loop
ThreadCodeErr1: ' ignore any error when an optimised compiled thread is stoppped
End Sub
Sub Thread_ThreadEvent
textbox1.Text = Angle ' do the update or whatever using the global value
End Sub