timerTicks fires every second, and runs sub CheckTableForNewRecords as long as IsCheckingTable = False.
Sub CheckTableForNewRecords determines if my SQL table has new records, if it does, it will run sub SQL.GetTrades on a new thread.
I need the property IsCheckingTable to change to False only when the threaded sub SQL.GetTrades is finished.
How do I do this?
Public Sub timerTicks() Handles EventTimer.Tick
    If IsCheckingTable = False Then
        CheckTableForNewRecords()
    End If
    Timertxt.Text = Date.Now
End Sub
Public Sub CheckTableForNewRecords()
    sw.Restart()
    sw.Start()
    IsCheckingTable = True
    PR = LR
    SQL.GETlastrcrd(QueryLR, LR)
    NR = LR - PR
    LastrcrdFRM.Text = LR
    PrvLastrcrdFRM.Text = PR
    NewRecordsFRM.Text = NR
    'check table
    If NR > 0 Then
        Dim QueryRR As String = "SELECT * from(select ROW_NUMBER() over (Order by StreamingID ) as row, " & _
                                "StreamingID,WatchlistID,symbol,Bid,Ask,Last,High,Low,PrevClose,Volume,TradeTime," & _
                                "QuoteTime,TradeDate,QuoteDate,Volatility,OpenInterest,UnderlyingSymbol,CallPut,TradeVolume,TradeAmount,Trade,LastSize from optionstream) " & _
                                "as StreamingID where StreamingID between " & PR & " AND " & LR
        Threading.ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf SQL.GetTrades), QueryRR)
    End If
    IsCheckingTable = False
    TEchecktradesFRM.Text = sw.ElapsedMilliseconds
End Sub