473,785 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tree view node selection

Hi all,

How do we select a tree view's node outside of a tree view event?

Looking through the lists there's no select function, the nearest I can find
is GetNodeAt but this seems to want the screen coordinates.

Thanks,
Adam
Apr 11 '06 #1
7 1468

with YourTreeview
.SelectedNode = TheTreeNodeYouW ishToSelect ' (for instance:
..Nodes(0))
end with

Adam Honek ha scritto:
Hi all,

How do we select a tree view's node outside of a tree view event?

Looking through the lists there's no select function, the nearest I can find
is GetNodeAt but this seems to want the screen coordinates.

Thanks,
Adam


Apr 12 '06 #2
Your code works great.

The only problem is I have 3 nodes that all have an index of 0.

Worst still I can't change it in the properties. Strange.

I have:

X (0)
------X (0)
----- X (0)
----- X (1)
----- X (2)
----- X (3)

Adam

<to************ **@uniroma1.it> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .

with YourTreeview
.SelectedNode = TheTreeNodeYouW ishToSelect ' (for instance:
.Nodes(0))
end with

Adam Honek ha scritto:
Hi all,

How do we select a tree view's node outside of a tree view event?

Looking through the lists there's no select function, the nearest I can
find
is GetNodeAt but this seems to want the screen coordinates.

Thanks,
Adam

Apr 12 '06 #3
I also tried selecting it by its name but no go.

The node isn't highlighted for some reason.

Adam

"Adam Honek" <Ad*******@Webm aster2001.frees erve.co.uk> wrote in message
news:Oo******** ******@TK2MSFTN GP05.phx.gbl...
Your code works great.

The only problem is I have 3 nodes that all have an index of 0.

Worst still I can't change it in the properties. Strange.

I have:

X (0)
------X (0)
----- X (0)
----- X (1)
----- X (2)
----- X (3)

Adam

<to************ **@uniroma1.it> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .

with YourTreeview
.SelectedNode = TheTreeNodeYouW ishToSelect ' (for instance:
.Nodes(0))
end with

Adam Honek ha scritto:
Hi all,

How do we select a tree view's node outside of a tree view event?

Looking through the lists there's no select function, the nearest I can
find
is GetNodeAt but this seems to want the screen coordinates.

Thanks,
Adam


Apr 12 '06 #4
Adam,

Be aware that this kind of code triggers the change events and can therefore
give some strange te first time not expected behaviour as you are not used
to that.

Just as little addition.

Cor

"Adam Honek" <Ad*******@Webm aster2001.frees erve.co.uk> schreef in bericht
news:ef******** ******@TK2MSFTN GP05.phx.gbl...
I also tried selecting it by its name but no go.

The node isn't highlighted for some reason.

Adam

"Adam Honek" <Ad*******@Webm aster2001.frees erve.co.uk> wrote in message
news:Oo******** ******@TK2MSFTN GP05.phx.gbl...
Your code works great.

The only problem is I have 3 nodes that all have an index of 0.

Worst still I can't change it in the properties. Strange.

I have:

X (0)
------X (0)
----- X (0)
----- X (1)
----- X (2)
----- X (3)

Adam

<to************ **@uniroma1.it> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .

with YourTreeview
.SelectedNode = TheTreeNodeYouW ishToSelect ' (for instance:
.Nodes(0))
end with

Adam Honek ha scritto:

Hi all,

How do we select a tree view's node outside of a tree view event?

Looking through the lists there's no select function, the nearest I can
find
is GetNodeAt but this seems to want the screen coordinates.

Thanks,
Adam



Apr 12 '06 #5
Hi Adam,

you have more than one possibility :

Private Sub TV_MouseDown(By Val sender As System.Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles TV.MouseDown
TV.actNode = TV.GetNodeAt(e. X, e.Y)
TV.SelectedNode = TV.actNode
End Sub

Direct methode (indexed) :
e.g.:
TV.SelectedNode = TV.nodes(0).nod es(0).nodes(2)
(assuming your example)

Klaus

Apr 12 '06 #6
Thanks a lot, got the code working once I added a TV.focus().

Adam

"Klaus" <k.******@chell o.at> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.com.. .
Hi Adam,

you have more than one possibility :

Private Sub TV_MouseDown(By Val sender As System.Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles TV.MouseDown
TV.actNode = TV.GetNodeAt(e. X, e.Y)
TV.SelectedNode = TV.actNode
End Sub

Direct methode (indexed) :
e.g.:
TV.SelectedNode = TV.nodes(0).nod es(0).nodes(2)
(assuming your example)

Klaus

Apr 12 '06 #7
After selecting the given node, what tree view event does it fire?

KeyDown???

Adam

"Klaus" <k.******@chell o.at> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.com.. .
Hi Adam,

you have more than one possibility :

Private Sub TV_MouseDown(By Val sender As System.Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles TV.MouseDown
TV.actNode = TV.GetNodeAt(e. X, e.Y)
TV.SelectedNode = TV.actNode
End Sub

Direct methode (indexed) :
e.g.:
TV.SelectedNode = TV.nodes(0).nod es(0).nodes(2)
(assuming your example)

Klaus

Apr 12 '06 #8

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

Similar topics

3
14036
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) The technical requirements: 1) Store tree data in the database so that it can be extracted as a tree structure. For test purposes,
3
10825
by: imani_technology_spam | last post by:
We need to present hierarchical data on a web page, the same way the tree view shows files in Windows Explorer. Here's the catch: that tree view needs to be bound to a SQL Server database. How can this be done?
0
2180
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i am able to check using xpath in asp.net 2.0 till MenuItem node. if i check visible attribute value till SubMenuLevel0 node then in tree it will not display the MenuItem Node at all Note: My tree Menu will start from MenuItem node and it will...
3
6060
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an hierarchical view of Parent Nodes and projects where in a projectnode can be added to any ParentNode and hence we may have a project node added to 100 Parent nodes. In this one, I have an operation of Renaming a Project Node. So whenever I am doing the...
1
3063
by: JN | last post by:
Hi All, I have a tree view which has parent nodes of each letter of the alphabet. The root node will be the customers name that relate to the parent node letter. I also have a gridview which is binded to the treeview control to display all customer records of the selected alphabetical letter. When I click expand the tree view and click on the customer's name, I get this error.: Please bear in mind that I have only been using ASP.net...
2
13139
by: Jerry Langley | last post by:
Once a treeview node is selected how can I programmatically unselect it so that it might be selected again following the first selection if the user desires? The after selection event only fires when the selection changes.
2
1351
by: dave.dolan | last post by:
I have generated a nice tree view that displays some otherwise cyptic XML in an easy to follow manner. The trouble is that the TreeView assumes that I'm wanting a link in each of the nodes, and I really just want to display them for view only. How can I disable the link-ness of the data in the tree view? I have tried setting the target of the links to "javascript:false;" but it still causes a postback and flashes the page to the top...
3
1269
by: Adam Honek | last post by:
Hi, I have the code below that I'm using in a tree view to detect what node the user has clicked on. It compiles but on runtime I get a type cast error. I've used this method for both the tool bar and menu and it works fine extending the "handles" property inherent within .net.
0
1140
by: Rohit111111 | last post by:
Hello all, I have a tree view control that will populate data upto n level,on selection of a node i am binding a datagrid on the same page,now i have to expand that node which i have selected,which is not expanded currently,after selecting a node data grid will be bind correctly but my tree will collasp all node i have to exapnd only that node which i have selected please help
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
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 we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.