473,466 Members | 1,511 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select TreeNode on Right-Click

How can I go about having a TreeNode selected when I right click? I
tried using the Click event, but the event does not pass in the node
that was clicked.

Currently you have to left click a node in order to select it. I want
to be able to write click and bring up a context menu with only certain
options available depending on the node selected. I got the context
menu to come up (which is very easy to do), however, you first have to
left click and then right click on a Node in order to have the context
menu pay attention to the node your right clicking on. Any help would
be most appreciated. Thanks.

Nov 16 '05 #1
2 10275
Add an event handler to the MouseDown event.
You can then use the GetNodeAt() method to set the SelectedNode propery of
the TreeView

Chris
"paradox" <de*@demiurgeinc.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
How can I go about having a TreeNode selected when I right click? I
tried using the Click event, but the event does not pass in the node
that was clicked.

Currently you have to left click a node in order to select it. I want
to be able to write click and bring up a context menu with only certain
options available depending on the node selected. I got the context
menu to come up (which is very easy to do), however, you first have to
left click and then right click on a Node in order to have the context
menu pay attention to the node your right clicking on. Any help would
be most appreciated. Thanks.

Nov 16 '05 #2
Very nice.. thanks.

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: G Uljee | last post by:
How can I find and select an specific item in an treeview control? I want to create a search feature on my treeview. Thanks in advance, Gaby
6
by: Dean L. Howen | last post by:
Hi, I want to add some attributes to TreeNode, so I create a new class MyNode that inheritance from System.Windows.Forms.TreeNode, I want to TreeView use MyNode instead of TreeNode, so I can...
2
by: Benny Raymond | last post by:
More problems with this... When I run this code, the main form returns an invalid cast exception as it's executing the line "TreeNode n = (TreeNode) this.Nodes;" Does anyone know what would...
2
by: Wes | last post by:
I have a treeview that I am continually added nodes to. Each time a new node is added I would like to select that node. Is this possible? I have looked at selectedNode, but I don't know how to...
6
by: Craig Lister | last post by:
I have a treeview with a Root, a Contact Type, and a Contact. Like MSN Messenger. Is there a way that I can say something like if treenode.tag is classContact then string Surname =...
1
by: Joerg Trumpfheller | last post by:
Hey people, how can I select a treenode with the MouseButtons.Right event if there is no contextmenu? I build up a treeview with 3 levels. Only if the second level is selected, there should...
4
by: KarlM | last post by:
Hallo! I'm filling my treenode tv with AD-infos with the following code: ____________________________________________________________________ private enum AdImages { AdRoot, Ou, Container,...
4
by: jmDesktop | last post by:
I have searched everywhere and tried several things. I have a treeview with and want to be able to only select a parent node. For example: root //don't want to drag this -parent1 //yes, drag...
1
by: jmDesktop | last post by:
I am trying to add nodes with keys to my treeview. I can add general nodes without problem with: //create new node TreeNode newNode = new TreeNode(myIdNumber); //create children TreeNode...
1
by: AAaron123 | last post by:
If you see this posted twice - sorry. My news reader showed my first post as "No Longer Available" I have the following in a .css file. The treeNodes behave as if they were "a" elements. ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.