Solved

Timesharing - getting multiple routines to run at once

Posted on 2001-06-04
4
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

710 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