DoubleClick a Treeview Node?

G

Guest

I am relativley new to C#, and I am trying to write code using the compact framework, that will allow a handheld user to hit enter while a treeview node is selected, which will then do something based on that nodes text. I cannot figure out how to write a method for this event for a single node. When I double click on the treeview in design mode, the only function it creates (no matter where I click) is private void treeView1_AfterSelect(...). So my question to you is, does anyone know how to write a method that will allow a user to hit enter while a node is selected? Its just a matter of getting my events straight (I think). Examples are appreciated.

Thanks,
JustinG
 
J

Jon Rea

Is this what you are after ???

private void treeView1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if( e.KeyChar == (char)Keys.Enter )
{
MessageBox.Show( treeView1.SelectedNode.Text );
}
}

Jon R

JustinG said:
I am relativley new to C#, and I am trying to write code using the compact
framework, that will allow a handheld user to hit enter while a treeview
node is selected, which will then do something based on that nodes text. I
cannot figure out how to write a method for this event for a single node.
When I double click on the treeview in design mode, the only function it
creates (no matter where I click) is private void
treeView1_AfterSelect(...). So my question to you is, does anyone know how
to write a method that will allow a user to hit enter while a node is
selected? Its just a matter of getting my events straight (I think).
Examples are appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top