BUG: Treeview Control Does Not Receive Key Events

Last reviewed: October 9, 1996
Article ID: Q150200
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 32-bit only, for Windows, version 4.0

SYMPTOMS

The Treeview control does not receive Key events for certain keystrokes. In particular, it does not generate events for the Enter key or the arrow navigation keys.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start a new project in Visual Basic. Form1 is created by default. Add a TreeView control to Form1. If the TreeView control is not visible in the ToolBox, from the Tools menu, select Custom Controls and select the Microsoft Windows Common Controls. Since TreeView is the only control on Form1, it receives the focus automatically.

  2. Place the following code in Form1:

       Private Sub TreeView1_KeyDown(KeyCode As Integer, Shift As Integer)
    
       Debug.Print "keyDown"
    
       End Sub
    
       Private Sub TreeView1_KeyPress(KeyAscii As Integer)
    
       Debug.Print "keyPress"
    
       End Sub
    
       Private Sub TreeView1_KeyUp(KeyCode As Integer, Shift As Integer)
    
       Debug.Print "keyUp"
    
       End Sub
    
    

  3. Run the project by pressing the F5 key. Press the Enter key or an arrow key and notice that no key events are generated. The Escape key, the backspace key, and other keys generate events correctly.


Additional reference words: 4.00 vb4win vb432
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrls


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 9, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.