Click to See Complete Forum and Search --> : Threading in VB


Rizwan Atique
September 24th, 2001, 12:15 PM
I like to create different threads for different processes in vb application. For example, I like to update the database at the same time I like to write the data to a flat file. I like to be able to do these two things separately from each other so that they don't wait for each other until one process is done. Any example or code would be helpful.

Thanks in advance.

cksiow
September 24th, 2001, 07:23 PM
just to clarify. you will got only one process in a vb application, not different threads for different processes, but you can have different threads in a process.

of course you can have multiple processes, by creating a out-of-process server (activeX exe), this is the simplest & most stable way of creating different threads in vb, unfortunately, I don't have code with me.

but, if you are using DAO, beware, it's not thread-safe. what I normally did is create a worker thread and using SendMessage to sync across multiple thread, i.e. only one thread will write to the database, and other threads will send request to it. again, unfortunately, I did it in VC++.


HTH

cksiow
http://vblib.virtualave.net - share our codes