The information in this article applies to:
- Microsoft Visual Basic Learning, Professional, and Enterprise Editions
for Windows, version 5.0
SYMPTOMS
Running a project in the IDE that displays a message box prevents events
from occurring. However, when you compile and run the same project as an
executable file (EXE), the events occur while the message box is displayed.
CAUSE
The behavior in the EXE is incorrect; events should not occur while a
Message box is displayed (as with earlier versions of Microsoft Visual
Basic).
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this bug and will post
new information here in the Microsoft Knowledge Base as it becomes
available.
MORE INFORMATION
Steps to Reproduce Behavior
- Start a new Standard EXE project in Visual Basic. Form1 is created by
default.
- Add two CommandButtons and one Timer control to Form1.
- Copy the following code to the Code window of Form1:
Option Explicit
Private Sub Form_Load()
Timer1.Interval = 1000
Command1.Caption = "Show Message Box"
Command2.Caption = "Show Modal Form"
End Sub
Private Sub Command1_Click()
MsgBox "Events Do Not Occur"
End Sub
Private Sub Command2_Click()
Form2.Show vbModal
End Sub
Private Sub Timer1_Timer()
Static intCount
intCount = intCount + 1
Form1.Print "Event # " & intCount
End Sub
- Add a second form to the Project by completing the following steps:
- From the Project menu, click Add Form. The Add Form dialog box
appears.
- From the New Tab, click Form.
- Click OK to close the Add Form dialog box. Form2 is added to the
project.
- On the Run menu, click Start or press the F5 key to start the program.
- Click Show Message Box after two events occur. Note that the Timer event
is no longer triggered.
- Click Show Modal Form to display a modal form. Note that the events
still occur even while the modal form is displayed.
- Compile the project and run the executable file as shown in step 6. Note
that the events still occur despite displaying the message box or form.