Microsoft KB Archive/150200

= FIX: Treeview Control Does Not Receive Key Events =

Article ID: 150200

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q150200



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 a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Basic 5.0.



Steps to Reproduce Problem
 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.  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  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 query words: kbVBp400bug kbVBp500fix kbVBp kbdsd kbDSupport kbControl

Keywords: kbbug kbfix kbvbp500fix KB150200

-

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

© Microsoft Corporation. All rights reserved.