Treeview & keydown

Treeview & keydown

Post by _SaM » Tue, 15 Apr 2008 18:42:51

his is a multi-part message in MIME format.

Hi all,

I have a treeview on a form populated with data, if I put a code in Treeview >> Keydown as follows

I have the treeview labelEdit = 1 && tvwManual

*** ActiveX Control Event ***
LPARAMETERS keycode, shift
IF keycode = 113 then && F2 is pressed
IF This.selectedItem.Children > 1 THEN
MESSAGEBOX("Cannot Edit")

If I Press "W" while the treeview has focus, the normal behaviour is select the the first visible node in the treeview that begin with "W", that is working if the above code is not present, if i put the above code, the function of searching the first letter in the treeview is stopped working.

is there a workaround for this?

Thanks in advance

Samir Ibrahim

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR>
<DIV>Hi all,</DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>I have a treeview on a form populated with data, if I put a code in
Treeview >> Keydown as follows</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><BR><FONT
face=Arial size=2><FONT face="Courier New" color=#0000ff size=2>
<P></FONT><FONT face="Courier New" size=2>I have the treeview labelEdit
</FONT><FONT face="Courier New" color=#ff0000 size=2>= 1 </FONT><FONT
face="Courier New" color=#008000 size=2>&&
tvwManual</P></FONT></FONT></DIV><FONT face="Courier New" color=#008000 size=2>
<P>*** ActiveX Control Event ***<BR></FONT><FONT face="Courier New"
color=#0000ff size=2>LPARAMETERS </FONT><FONT face="Courier New"
size=2>keycode</FONT><FONT face="Courier New" color=#ff0000 size=2>,
</FONT><FONT face="Courier New" color=#0000ff size=2>shift<BR></FONT><FONT
face="Courier New" color=#0000ff size=2>IF </FONT><FONT face="Courier New"
size=2>keycode </FONT><FONT face="Courier New" color=#ff0000 size=2>= 113
</FONT><FONT face="Courier New" color=#0000ff size=2>then <FONT
color=#008000>&& F2 is pressed<BR></FONT>    IF
This</FONT><FONT face="Courier New" color=#ff0000 size=2>.</FONT><FONT
face="Courier New" size=2>selectedItem</FONT><FONT face="Courier New"
color=#ff0000 size=2>.</FONT><FONT face="Courier New" size=2>Children
</FONT><FONT face="Courier New" color=#ff0000 size=2>> 1 </FONT><FONT
face="Courier New" color=#0000ff size=2>THEN<BR></FONT><FONT face="Courier New"
color=#0000ff size=2>       
MESSAGEBOX</FONT><FONT face="Courier New" color=#ff0000 size=2>(</FONT><FONT
face="Courier New" color=#000080 size=2>"Cannot Edit"</FONT><FONT
face="Courier New" color=#ff0000 size=2>)<BR></FONT><FONT face="Courier New"
color=#0000ff size=2>      &nbs

1. Here is the syntax for TreeView.KeyDown().

2. treeView keydown

What is wrong in this code?

private void tree_KeyDown(object sender, System.Windows.Forms.KeyEventArgs


if (e.KeyCode == Keys.Enter )


ConnString = "workstation id=HRV;packet size=4096;integrated
security=SSPI;data source=HRV;persist security info=False;initial
catalog=DVD Kolekcija";

bDb = new Db(ConnString);


grid.Table = bDb.datasetDVD.Tables ["DVD"];



I press ENTER when I'm on treeview control but nothing happens!


3. treeView and KeyDown question

4. KeyPreview/KeyDown on TreeView control - Possible Bug?

5. Treeview, avoid selecting node on keydown or up

6. Can't use Keydown event in treeview

7. KeyDown event catching in TreeView AfterLabelEdit event

8. Can't use Keydown event in treeview

9. TreeView to TreeView?

10. Any TreeView or "DB"TreeView that supports drag4n drop ???

11. PLEASE: Treeview Variable into TreeView...

12. TreeView - Reloading the treeView and expanding the last selected

13. Assigning TreeView Class Instance to a TreeView Control

14. Treeview: Node.LastNode only works at end of treeview

15. Generate XPathExpression from TreeView in C# OR Remember what user picked in TreeView