Link to home
Start Free TrialLog in
Avatar of DavidGreenfield
DavidGreenfieldFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to create a Thread Handler

How can I create an array? of threads that are accessible from forms and classes within my application??

I am putting

Public thread_handler() As Thread

in my form and adding threads using

        Dim count As New Integer
        If thread_handler Is Nothing Then count = 0 Else count = UBound(thread_handler) + 1
        ReDim Preserve thread_handler(count)
        thread_handler(count) = t 'add thread to thread handler

but is this correct and is there a better way as I am having some problems with checking threads (where activex objects aren't returning information)  ie.

Error: COM object that has been separated from its underlying RCW cannot be used.

System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used

and I think its because of the way I am handling them???

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial