Solved

DOevents question

Posted on 1998-09-16
1
202 Views
Last Modified: 2010-04-30
I am writing a serial interface program and use the loop to poll the data from buffer. In the loop there is a Doevents to return the control to the OS. If during the Doevents period the user press stop button, can I get out of the loop that I was running and do something else?
0
Comment
Question by:Overflow
1 Comment
 
LVL 4

Accepted Solution

by:
trkcorp earned 50 total points
ID: 1435339
Yes. That is the purpose of DoEvents, to allow a break in a hard loop. In order to make this work though you will have to be able to detect that the button was clicked from within your hard loop and then take appropriate action.  For example:

Option Explicit
Dim bStop as Boolean

Private Sub cmdStop_Click()
bStop = True
End Sub

Sub HardLoop()
Do
  DoEvents
  If bStop then Exit Do 'or maybe Exit Sub?
Loop
End Sub

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

910 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

18 Experts available now in Live!

Get 1:1 Help Now