473,407 Members | 2,315 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,407 software developers and data experts.

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 1450

with YourTreeview
.SelectedNode = TheTreeNodeYouWishToSelect ' (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.googlegr oups.com...

with YourTreeview
.SelectedNode = TheTreeNodeYouWishToSelect ' (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*******@Webmaster2001.freeserve.co.uk> wrote in message
news:Oo**************@TK2MSFTNGP05.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.googlegr oups.com...

with YourTreeview
.SelectedNode = TheTreeNodeYouWishToSelect ' (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*******@Webmaster2001.freeserve.co.uk> schreef in bericht
news:ef**************@TK2MSFTNGP05.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*******@Webmaster2001.freeserve.co.uk> wrote in message
news:Oo**************@TK2MSFTNGP05.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.googlegr oups.com...

with YourTreeview
.SelectedNode = TheTreeNodeYouWishToSelect ' (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(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) 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).nodes(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.******@chello.at> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
Hi Adam,

you have more than one possibility :

Private Sub TV_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) 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).nodes(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.******@chello.at> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
Hi Adam,

you have more than one possibility :

Private Sub TV_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) 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).nodes(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
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.) ...
3
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...
0
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...
3
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...
1
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...
2
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...
2
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...
3
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...
0
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...
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: 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?
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
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...
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
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...

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.