Solved

Timesharing - getting multiple routines to run at once

Posted on 2001-06-04
4
155 Views
Last Modified: 2010-05-02
I have a MDI application. Each child form has it's own routines. after starting a routine on one form and then starting another routine on another form, the first form routine quits or locks up. I would like to time share between the two. How can I do this - run multiple routines at once?
0
Comment
Question by:Spikeman
  • 2
4 Comments
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6153347
The easiest way is to put DoEvents all over the place. This will give you quasi time slicing. A better way may be to use out of process ActiveX exe's. It may also be possible to multi-thread your application but I have no idea how.

Zaphod.
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 50 total points
ID: 6153519
The easiest way to achieve "time-slicing" or multitasking within a VB app is to add a timer control for each task.

Activate the timer and it runs in its own thread, thereby allowing you to process whatever is in the Timer event procedure.

If you then activate another timer, you can run another thread.

The DoEvents mention in a previous comment would be useful if the thread is doing a large amount of processing, typically inside a loop.
0
 

Author Comment

by:Spikeman
ID: 6154210
Thank you. I have timers currently in my code but since I'm monitoring com ports for data it makes putting my routines in a timer difficult as I'm triggering off of the MScomm_Oncomm event. Thanks again!
0
 

Author Comment

by:Spikeman
ID: 6154215
Thank you. I do have doevents all over but since I was using the MScomm_Oncomm event to trigger on Com port inputs it kept the focus tied up there. I should of mentioned this in my question. Thanks again.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now