H
Hugh Janus
Hi all,
I know this has been discussed a million times here but either I am not
finding the right information yet or I just do not understand it.
My problem: I am using VB.NET 2003. As part of my app, I have a
Listview that has a list of directories in the left column. In the
right column I want to put the total size of each folder. So, I've
wrote the function to return each size and I can get it to total each
folder line by line. However, this takes ages! So, I want to fire off
a thread for each folder and total them all at the same time. This is
where my problem is.
I can fire off the threads but only if I declare each thread
seperately. As I do not know how many threads I need, I want to create
a "Thread Array" of some sort. i.e. Thread(#).Start etc. etc. This I
do not know how to do. But, worse still, I wrote a function that
totals up the sizes and returns a value with the total. This works by
passing the path name as a string to the function. When I try to do
this via a thread I get an error telling me basically that you cannot
pass arguments to a function in a thread. So I am stuck!
As a summary, what I want to do is:
- Create x number of threads based on how many rows are in the
listview.
- Fire them all at once (to run together) and pass the path as an
argument.
Is this even possible? If so, any help would be most appreciated.
Thanks,
Hugh.
I know this has been discussed a million times here but either I am not
finding the right information yet or I just do not understand it.
My problem: I am using VB.NET 2003. As part of my app, I have a
Listview that has a list of directories in the left column. In the
right column I want to put the total size of each folder. So, I've
wrote the function to return each size and I can get it to total each
folder line by line. However, this takes ages! So, I want to fire off
a thread for each folder and total them all at the same time. This is
where my problem is.
I can fire off the threads but only if I declare each thread
seperately. As I do not know how many threads I need, I want to create
a "Thread Array" of some sort. i.e. Thread(#).Start etc. etc. This I
do not know how to do. But, worse still, I wrote a function that
totals up the sizes and returns a value with the total. This works by
passing the path name as a string to the function. When I try to do
this via a thread I get an error telling me basically that you cannot
pass arguments to a function in a thread. So I am stuck!
As a summary, what I want to do is:
- Create x number of threads based on how many rows are in the
listview.
- Fire them all at once (to run together) and pass the path as an
argument.
Is this even possible? If so, any help would be most appreciated.
Thanks,
Hugh.