Results 1 to 5 of 5

Thread: Threading...

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

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

  2. #2

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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()'.

  3. #3

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    ahhh..seems like i can only put in addressof **** sub's and not funcions...

  4. #4
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    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.

  5. #5
    hellswraith
    Guest
    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
  •  



Click Here to Expand Forum to Full Width