Private Declare Function CreateThread Lib "kernel32" (ByVal lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Private Declare Function TerminateThread Lib "kernel32" (ByVal hThread As Long, ByVal dwExitCode As Long) As Long
Dim id1 As Long
Private Sub Command1_Click()
Call TerminateThread(id1, ByVal 0&)
End Sub
Private Sub Form_Load()
id1 = CreateThread(ByVal 0&, ByVal 0&, AddressOf ShowValue1, ByVal 0&, 0, id1)
End Sub
.......นี่ส่วนใน Moudle ครับ .......
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Function ShowValue1()
Do
Form1.Label1.Caption = Now
Sleep (1)
Loop
End Function