LankanDude
New member
- Joined
- May 23, 2006
- Messages
- 2
- Programming Experience
- 1-3
Please tell me how to do the below.
I need to pass a value from a sub to another sub.
But the second sub has to be called by the first sub using a thread.
Given below are the approaches that I took.
But none of them worked.
1)
Public Class MyClass
Public Sub MyThreadFunc( ByVal RequestXmlStr As String)
Dim BankReportThread As New Thread(AddressOf MyFunc(RequestXmlStr ))
BankReportThread.Start()
End Sub
Public Sub MyFunc( ByVal RequestXml As String)
Dim X as String
X = RequestXml
End Sub
End Class
2)
Public Class MyClass
Public Sub MyThreadFunc( ByVal RequestXmlStr As String)
Dim BankReportThread As New Thread(AddressOf MyFunc)
BankReportThread.AllocateNamedDataSlot("RequestXml")
BankReportThread.SetData(BankReportThread.GetNamedDataSlot("RequestXml"), RequestXmlStr)
BankReportThread.Start()
End Sub
Public Sub MyFunc( ByVal RequestXml As String)
Dim X as String
Dim returnValue As LocalDataStoreSlot
returnValue = Thread.GetNamedDataSlot("RequestXml")
X = CStr(Thread.GetData(returnValue))
End Sub
End Class
I need to pass a value from a sub to another sub.
But the second sub has to be called by the first sub using a thread.
Given below are the approaches that I took.
But none of them worked.
1)
Public Class MyClass
Public Sub MyThreadFunc( ByVal RequestXmlStr As String)
Dim BankReportThread As New Thread(AddressOf MyFunc(RequestXmlStr ))
BankReportThread.Start()
End Sub
Public Sub MyFunc( ByVal RequestXml As String)
Dim X as String
X = RequestXml
End Sub
End Class
2)
Public Class MyClass
Public Sub MyThreadFunc( ByVal RequestXmlStr As String)
Dim BankReportThread As New Thread(AddressOf MyFunc)
BankReportThread.AllocateNamedDataSlot("RequestXml")
BankReportThread.SetData(BankReportThread.GetNamedDataSlot("RequestXml"), RequestXmlStr)
BankReportThread.Start()
End Sub
Public Sub MyFunc( ByVal RequestXml As String)
Dim X as String
Dim returnValue As LocalDataStoreSlot
returnValue = Thread.GetNamedDataSlot("RequestXml")
X = CStr(Thread.GetData(returnValue))
End Sub
End Class