BUG: Changing Caption of Menu Item Corrupts Shortcut Key Text

ID: Q92940


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0


SYMPTOMS

At run time, if you change the caption property of a menu item that has a shortcut key assigned to it, the text defining the shortcut key to the right of the menu item is corrupted. However, the shortcut key sequence continues to work.


WORKAROUND

To work around the problem, append CHR$(0) to the new Caption setting as in this example:


   MItem1.Caption = "First" + CHR$(0) 
Or have a second menu, and set its visible property to false. Then at run time, set the second menu's visible property to true and the first menu's visible property to false.


STATUS

Microsoft has confirmed this to be a bug in Microsoft Visual Basic for MS-DOS, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

Steps to Reproduce Problem

  1. Start VBDOS.EXE.


  2. From the File menu select New Form... (Form1.Frm).


  3. From the Window menu, select Menu Design Window.


  4. Add a top level menu, caption = File, ctrlname = FileMnu.


  5. Add a sub item to the top level menu, caption = Item1, ctrlname = MItem1. Select a Shortcut Key for this menu item from the Shortcut Key list box.


  6. Exit the Menu Design Window.


  7. Exit the Form Designer, save all changes.


  8. Add the following code to the Form_Click event procedure of Form1:
    
       SUB Form_Click()
          MItem1.Caption = "First"
       END SUB 


  9. Add the following code to the MItem1_Click event procedure of the menu item MItem1:
    
       SUB MItem1_Click()
          Print "Menu Item 1 Selected"
       END SUB 


  10. Run the application.


  11. Select the File menu, notice the Shortcut Key description to the right of the menu item (Item1).


  12. Press the keys to activate the Shortcut key, notice that it prints the text on the form as it should.


  13. Click on Form1.


  14. Select the menu File, notice the Shortcut Key description is now corrupted.


  15. Press the keys to activate the Shortcut key as before, notice that it still works, even though the text describing it is corrupted.


Additional query words: VBmsdos buglist1.00 1.00

Keywords :
Version : MS-DOS:1.0
Platform : MS-DOS
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.