views:

135

answers:

2

Hi!

I have a TreeView in my form for which I dont want to have key input enabled. Which means that if I have this tree structure:

Root
|
-- Abba
|
-- Basic
|
-- Center

...and press "b"-key. I do not want "Basic" to be selected. I only want the user to be able to select nodes using mouse input.

Any ideas on how to achieve this?

A: 

First thought: You could overload the OnKey* events to do nothing.

Sani Huttunen
+1  A: 

in key press event of tree view

if(Char.IsDigit(e.KeyChar) || Char.IsLetter(e.KeyChar))

{

e.Handled = true;

}

Searock
My guts tell me you should write e.Handled = true;
DonkeyMaster
sorry it always confuses me, untill i dont run the code
Searock