Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Timesharing - getting multiple routines to run at once

Posted on 2001-06-04
4
Medium Priority
?
167 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 150 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

782 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