Threading and AddressOf in VB.Net

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

Hi, can someone tell me why wont this work:

Dim t1 As New System.Threading.Thread( _
AddressOf reflectionBegin(aString As String))
Referring to 'As' - Compiler says that Comma, ')' or a valid expression
continuation expected.

I am trying to get AddressOf to point to this method:

.....
Public Sub reflectionBegin(ByVal aString As String)
.....

How do i do it? All the examples show methods with no paramaters included.
When i don't include paramaters compiler says signature not the same.

".... Method 'Public Sub reflectionBegin(aString As String)' does not have
the same signature as delegate 'Delegate Sub ThreadStart()'....."

How do I fix it?

thx
Nick.
 
You can't, because your reflectionBegin method does not match the thread
start delegate.

Hit Google and look for "pass value to thread" or some such. You'll find
examples of how to do that.
 
Back
Top