Thread.ThreadID

From Xojo Documentation

Read-Only Property (As Integer )
IntegerValue = aThread.ThreadID

Supported for all project types and targets.

ID of the thread, assigned at runtime.

Notes

Note: ThreadID will be non-zero only when the Thread is running.

Example

This example reports the ThreadID only if the thread is running.

If LongProcessThread1.State <> Thread.NotRunning Then
MessageBox(LongProcessThread1.ThreadID.ToString)
Else
MessageBox("The thread is not running!")
End If