Results 1 to 2 of 2

Thread: Threading help

  1. #1
    egiggey
    Guest

    Threading help

    i have the following code which I am having trouble with.
    what I need to do is pass viriables to the function the thread will be executing
    here's what I have so far
    Public Function startdlthread(ByRef url As String, ByRef LocalFilename As String, ByRef filecount As Short)
    dlthread = New System.Threading.Thread(AddressOf DownloadFile(url, LocalFilename, filecount))
    dlthread.Start()
    End Function

    this is the what i get for an error
    AddressOf operand must be the name of a method; no parentheses are needed.

    what am i missing here ?

  2. #2
    Lively Member
    Join Date
    Aug 1999
    Location
    Amsterdam
    Posts
    117
    You can't pass any parameters to a method call when explicitally executing it on a new thread.

    If you really need the create a new thread explicitally you could pass the parameters in the constructor.

    If you don't need to explicitally create the new thread, you could use for example an async delegate, which does support passing parameters.

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