Ok, here is my dilemma. I have a multi-threaded application using threadpooling that spawns multiple threads as needed. Inside my sub-routine I have a variable named strCounter. The problem is, when more than one thread gets called it is sharing the strCounter variable. How can I keep the variable unique to that thread so that it does not get incremented from other threads. I am diming the variable in the main class as Private which does not appear to help.

Here is a example:

Public Class Main

Private strCounter as integer

Sub Timer
While oDataReader.Read()
ThreadPool.QueueUserWorkItem(AddressOf Reboot, oDataReader("Server") & "|" & oDataReader("PKey") & "|" & oDataReader("Notify"))
End While
End Sub

Public Sub Reboot(ByVal State As Object)
Code....
strCounter += 1
End Sub

End Class