Microsoft KB Archive/100067
PSS ID Number: 100067
Article Last Modified on 1/8/2003
The information in this article applies to:
- Microsoft Visual Basic for MS-DOS 1.0
This article was previously published under Q100067
Event handlers for the ON ... GOSUB statements do not occur while a modal form or MSGBOX is showing. However, event processing does occur as you move the mouse cursor over the modal form or if you press a key.
This behavior is by design; it is not a bug. The ON ... GOSUB statements do not function while a Basic statement is executing. This includes the MSGBOX statement as well as form.SHOW 1. Events processing occurs when you move the mouse or press a key because this causes user statements to execute (for example, KeyPress and MouseMove).
- Show all forms non-modally. Instead of using MSGBOX, display a non-modal form to display messages.
- Instead of ON COM GOSUB, use a timer control on a form that checks LOC to see if characters are waiting.
This behavior is by design.
This problem applies to the following statements
Steps to Reproduce Problem
In VBDOS.EXE, enter the following code and run it.
ON TIMER(1) GOSUB xyz TIMER ON MSGBOX "hello world" CLS PRINT "press a key to quit" DO WHILE INKEY$ = "" LOOP END xyz: BEEP RETURN
- A message box is displayed, preventing ON TIMER GOSUB events. Moving the mouse across the message box allows the events and you hear beeping.
- Click the OK button and the ON TIMER GOSUB handler resumes beeping once per second.
Additional query words: VBmsdos 1.00
Keywords: kbprb KB100067
Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3