Threading and AddressOf in VB.Net

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.
 
K

Klaus H. Probst

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top