pmclinn,
You can pass any value via the stateInfo parameter.
For example, if I wanted to pass a String I could do something like:
Dim variable As String
ThreadPool.QueueUserWorkItem(AddressOf WriteFiles, variable)
Public Sub WriteFiles(ByVal stateInfo As Object)
Dim variable As String = DirectCast(stateInfo, String)
...
End Sub
If I wanted to pass more then one value I would define a Parameter Object,
something like:
Public Class WriteFilesParameters
Public Variable1 As String
Public Variable2 As String
Public Variable3 As Integer
End Class
Dim variable As WriteFilesParameters
ThreadPool.QueueUserWorkItem(AddressOf WriteFiles, variable)
Public Sub WriteFiles(ByVal stateInfo As Object)
Dim variable As WriteFilesParameters = DirectCast(stateInfo,
WriteFilesParameters)
...
End Sub
Hope this helps
Jay
| In the code format below, is there any way to pass in a variable to the
| writefiles proceedure?
|
|
| ThreadPool.QueueUserWorkItem(AddressOf WriteFiles)
|
|
| Public Sub WriteFiles(ByVal stateInfo As Object)
|
| End Sub
|