Microsoft KB Archive/92940

= BUG: Changing Caption of Menu Item Corrupts Shortcut Key Text =

PSS ID Number: 92940

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 Q92940



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 = &quot;First&quot; + 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.



Steps to Reproduce Problem
 Start VBDOS.EXE. From the File menu select New Form... (Form1.Frm). From the Window menu, select Menu Design Window. Add a top level menu, caption = File, ctrlname = FileMnu. 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. Exit the Menu Design Window.</li> Exit the Form Designer, save all changes.</li>  Add the following code to the Form_Click event procedure of Form1: SUB Form_Click MItem1.Caption = &quot;First&quot; END SUB </li>  Add the following code to the MItem1_Click event procedure of the menu item MItem1: SUB MItem1_Click Print &quot;Menu Item 1 Selected&quot; END SUB </li> Run the application.</li> Select the File menu, notice the Shortcut Key description to the right of the menu item (Item1).</li> Press the keys to activate the Shortcut key, notice that it prints the text on the form as it should.</li> Click on Form1.</li> Select the menu File, notice the Shortcut Key description is now corrupted.</li> Press the keys to activate the Shortcut key as before, notice that it still works, even though the text describing it is corrupted.</li></ol>

Additional query words: VBmsdos buglist1.00 1.00

Keywords: kbbug KB92940

Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3

-

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

© 2004 Microsoft Corporation. All rights reserved.