Disable key entry in TreeView

I have a TreeView in my form that I dont want to include a key for. This means that if I have this tree structure:

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

      

... and press the key b. I don't want to choose "Basic". I want the user to be able to select nodes using mouse input.

Any ideas on how to achieve this?

+1


a source to share


2 answers


in the keypress event of the treeview



  if(Char.IsDigit(e.KeyChar) || Char.IsLetter(e.KeyChar))
  {
       e.Handled = true;
  }

      

+3


a source


First thought: you can overload the OnKey * events to do nothing.



0


a source







All Articles