Multi threading a function?
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
2 posts
Page 1 of 1
Hi i was wondering if it is possible to multi thread a function, im running this function to download files from a website so the function will look like this. the problem is i run this function many times and it will make the program be unusuable while its downloading
Code: Select all
When trying to do it as i usually would i get this
Public Function download(ByVal URL, ByVal fileName, ByVal downloadPath)
'Download code here
end Function
Code: Select all
Error 2 'AddressOf' operand must be the name of a method (without parentheses). path\Form1.vb 52 72 program
Last edited by AnoPem on Sun Feb 08, 2015 5:45 pm, edited 1 time in total.
You want insert a thread for this function?
Code: Select all
alsoImports System.Threading
Dim Update_Job As Thread
Update_Job = New Thread(Sub() download(url,fileName,downloadPath)
Update_Job.Start()
Code: Select all
UPDATE: I see now your edit, use Sub() instead of AddressOfImports System.Threading
ThreadPool.QueueUserWorkItem(Sub() download(url,fileName,downloadPath))
I'm in the empire business.
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023