|
-
Jul 17th, 2002, 10:04 AM
#1
Thread Starter
yay gay
Threading...
in threading am i allowed to thread a function wich has paramentrs?
i tryed
dim MyThread as thread
MyThread=new Thread(adress of downloadfile(url,filename))
and it is not working..any ideas..?
-
Jul 17th, 2002, 10:15 AM
#2
Thread Starter
yay gay
another error...
C:\Documents and Settings\JBRANCO\My Documents\Visual Studio Projects\thread test\Form1.vb(94): Method 'Public Function DownloadPic() As Object' does not have the same signature as delegate 'Delegate Sub ThreadStart()'.
-
Jul 17th, 2002, 10:17 AM
#3
Thread Starter
yay gay
ahhh..seems like i can only put in addressof **** sub's and not funcions...
-
Jul 17th, 2002, 11:40 AM
#4
The entrypoint for the thread must match the delegate definition used in the thread class's constructor:
<Serializable>
Public Delegate Sub ThreadStart()
This means the entrypoint must be parameterless and must be a sub. If you need parameters, you have to make properties for them, so you can first set the properties, and then start the thread with a parameterless sub. You can then use the properties instead of the missing parameters.
Editted: It would not make any sense to start a thread at a function.
You would have to wait to get the return value, so the benefit of a seperate thread would be vanished.
-
Jul 17th, 2002, 10:07 PM
#5
Just a note, you can just have your method raise an event when it is done. Then pass in as arguements the value(s) you want to return.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|