Microsoft KB Archive/100067

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

SYMPTOMS

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.

CAUSE

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).

WORKAROUND

  • 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.


STATUS

This behavior is by design.

MORE INFORMATION

This problem applies to the following statements

ON COM
ON PLAY
ON STRIG
ON TIMER
ON UEVENT


Steps to Reproduce Problem

  1. 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
                            
  2. A message box is displayed, preventing ON TIMER GOSUB events. Moving the mouse across the message box allows the events and you hear beeping.
  3. 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