I want to navigate through a treeview with the keyboard while the focus is on another control (a textbox)..
When I hit vbkeyup I want to goup an item
when I hit vbkeydown I want to go down an item... I thought of the following code:
This does not work completely because it will never exit the root node... It will only go up or down within the same pathCode:Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) On Error GoTo EOF_Error Select Case KeyCode Case vbKeyDelete m_bEditFromCode = True Case vbKeyBack m_bEditFromCode = True Case vbKeyUp ' tvwTree.SetFocus tvwTree.SelectedItem.Previous.Selected = True Case vbKeyDown ' tvwTree.SetFocus tvwTree.SelectedItem.Next.Selected = True End Select EOF_Error: If Err.Number = 91 Then Resume Next End Sub
How can I accomplish to make it go up an item when I hit vbkeyup and down an item when I click vbeydown ??


Reply With Quote
