473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to select treeview nodes using right click

Hi
i have some nodes in the treeview. how can i select the node by directly right clicking on the node?
May 22 '07 #1
1 2550
Finally I got the answer...
Private Sub TreeView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseUp
' Show menu only if Right Mouse button is clicked
If e.Button = Windows.Forms.MouseButtons.Right Then
' Point where mouse is clicked
Dim p As Point = New Point(e.X, e.Y)
' Go to the node that the user clicked
Dim node As TreeNode = TreeView1.GetNodeAt(p)
If Not node Is Nothing Then
TreeView1.SelectedNode = node
' ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
End If
End If
End Sub
Jun 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: feel | last post by:
Goin' crazy with this recursive function ported from delphi... I send a string like DirA/ DirB /DirC but i get in the treeView each one in a new node.Cant get the child node....!! -DirA -DirB...
13
by: André Nogueira | last post by:
Hi there. I know you can view a node's fullpath property, but is it posible to select a node using its path? Like, tell the treeview that the node that should be selected is the node with the...
14
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
4
by: praveen | last post by:
I have a form with treeview control loaded from xml document,text box, two buttons named "Find" and "FindNext" and my treeview which looks like below. Details |__ policy status |__ created by...
0
by: rhaazy | last post by:
Using VS2003 C# I have a treeview control that navigates through a database in non heiarchal fashion. I start with the root node, which is just going to be the name of the database, so it will...
0
by: lewis76 | last post by:
I have figured out how to populate a treeview with an xml file however I just can't for the life of me get this formatting of the nodes right. Here's where I'm at: <Season>...
1
by: karthee | last post by:
I am creating a custom treeview with multiple selection, if i select multiple nodes and right click, the selection is disappearing, i tried with somany things like on mouse click my code is...
0
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. ...
0
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I have a treeview setup on my page. In case it is relevant, it is set in an accordion, which is inside an update panel. When I click the treeview node, a page loads on the right side of my browser...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.