• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

VB and Threads?

Dear Experts

I need to wait for a boolean variable to become TRUE before i can proceed through to the next statement - this boolean variable is set to true when an event occurs - is there anyway i could possibly create a thread which keeps evaluating this process. or simply wait for the event to occur before the program execution carries on?

Thanks
0
Mr_A_Smith
Asked:
Mr_A_Smith
  • 2
1 Solution
 
DhaestCommented:
While YourBool = false
   doEvents
wend
0
 
DhaestCommented:
Read this article about threads in VB:
http://www.desaware.com//articles/threadingL3.htm

Quite often, the method to achieve this in VB is to use ActiveX EXEs:
thread/exethr.htm">http://www.vbaccelerator.com/codelib/thread/exethr.htm

Multi Threading in VB can be accomplish throw activeX exe
Don't use Createthread since VB6 is an appartment thread and It will may cause your system to crash.
Save yourself the trouble and do it with .NET
If you want to do it with VB 6 you should read this from the vb6 documentaion
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconprojectoptionsforcodecomponents.asp

2 more examples:
Rant: Multithreading: A Kludge for Poor Software Design
http://www.vb-helper.com/rant_multithreading.html
HowTo: Let a long process run asynchronously without multithreading
http://www.vb-helper.com/howto_async_process.html 
0
 
Mr_A_SmithAuthor Commented:
Dear Dhaest,

Your first post did the trick, no threading needed. Thank you very much :)
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now