Microsoft KB Archive/167839

= BUG: PopupMenu on Modal Form Not Displayed =

Article ID: 167839

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Control Creation Edition
 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q167839



SYMPTOMS
If an application contains at least two forms and one of those forms is displayed modally by using a PopupMenu on another form, a PopupMenu on the modal form will not be displayed.



RESOLUTION
A Timer control can be used to work around this problem:

 Start a new Standard EXE project. Form1 is added by default. Add a Timer control (Timer1) to Form1. Add another form (Form2) to the project. On Form1, create a menu (mnuFile) with a caption of "File" that has a submenu (mnuOpen) with a caption of "Open." On Form2, create a menu (mnuEdit) with a caption of "Edit" that has a submenu (mnuFind) with a caption of "Find."  Add the following code to the General Declarations section of Form1: Private Sub Form_Load Timer1.Enabled = False Timer1.Interval = 1 End Sub

Private Sub Form_Click PopupMenu mnuFile End Sub

Private Sub Timer1_Timer Form2.Show 1 Timer1.Enabled = False End Sub

Private Sub mnuOpen_Click Timer1.Enabled = True End Sub

  Add the following code to the General Declarations section of Form2: Private Sub Form_Click PopupMenu mnuEdit End Sub

 Press the F5 key to run the program. Click on Form1 and the Open PopupMenu will be displayed. Click on the Open PopupMenu and Form2 is shown modally. Click on Form2 and the Edit PopupMenu is displayed.</li></ol>

<div class="status_section">

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.

<div class="moreinformation_section">

Steps To Reproduce Problem
<ol> Start a new Standard EXE project. Form1 is added by default.</li> Add another form (Form2) to the project.</li> On Form1, create a menu (mnuFile) with a caption of "File" that has a submenu (mnuOpen) with a caption of "Open." On Form2 create a menu (mnuEdit) with a caption of "Edit" that has a submenu (mnuFind) with a caption of "Find."</li>  Add the following code to the General Declarations section of Form1: Private Sub Form_Click PopupMenu mnuFile End Sub

Private Sub mnuOpen_Click Form2.Show 1 End Sub

</li>  Add the following code to the General Declarations section of Form2: Private Sub Form_Click PopupMenu mnuEdit End Sub

</li> Press the F5 key to run the program. Click on Form1 and the Open PopupMenu will be displayed. Click on the Open PopupMenu and Form2 is shown modally. Click on Form2 and the Edit PopupMenu is not displayed.</li></ol>

Additional query words: kbVBp500bug kbVBp600bug kbVBp400bug kbVBp kbdsd kbDSupport kbNoKeyWord

Keywords: kbbug KB167839

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.