473,769 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Treeview Selected Item

Hi

There is probably a very simple answer to this, but I am not too
familiar with the treeView control...

I have a treeview control, populated from a database. I want to be
able to get the text property of the slected node when a user selects
one, but I don't know which methods to use.

If I try "Click" or "MouseDown" , the returned string seems to be the
text of the previously selected item. (eg. "Item 17" is selected.
Click Item 4 and the returned value of treeNode1.Selec tedNode.Text is
"Item17")

Can anyone point me at a resource to show me how to accurately get the
value of the *currently* selected item, or tell me which event I need
to trap to get the desired results.

(Of course, keyboard navigation is going to be an issue as well...)

TIA
Marc.
Nov 16 '05 #1
1 7717
Oops. Found it. I was using the "Click" event of the treeview
control. I just discovered there is an "AfterSelec t" method.

I love Google. :)

On Fri, 12 Nov 2004 10:31:50 +0000, Marc Jennings
<Ma**********@c ommunity.nospam > wrote:
Hi

There is probably a very simple answer to this, but I am not too
familiar with the treeView control...

I have a treeview control, populated from a database. I want to be
able to get the text property of the slected node when a user selects
one, but I don't know which methods to use.

If I try "Click" or "MouseDown" , the returned string seems to be the
text of the previously selected item. (eg. "Item 17" is selected.
Click Item 4 and the returned value of treeNode1.Selec tedNode.Text is
"Item17")

Can anyone point me at a resource to show me how to accurately get the
value of the *currently* selected item, or tell me which event I need
to trap to get the desired results.

(Of course, keyboard navigation is going to be an issue as well...)

TIA
Marc.


Nov 16 '05 #2

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

Similar topics

6
4934
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview. However, either it only add it to the root level or it only add it on level below, doesn't matter what I select. And in some case, I just get an exception.
7
3770
by: amruta | last post by:
the code below dows not let me get the parent child view... all the nodes are show in one line only... also i need them to be collasped ... Thanks ..
4
9416
by: Andrew Robinson | last post by:
I am using a TreeView to perform navigation and have a few nodes that need to generate a popup menu. For this, I use the SelectedNodeChanged event and then add the relevant "window.open" script to the page using the ClientScript.RegisterStartupScript method. This seems to work fine, but if the user clicks on the same node twice, the event doesn't fire a second time. I assume this is by design as the Node Selection hasn't changed, but...
2
7500
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView nodes. The TreeView populates dynamically as there are a significant number of nodes. The DataGrid displays both the items and the nodes from the TreeView. Using the explorer analogy this means the TreeView shows folders, and the DataGrid folders...
6
11684
by: cyriel1920 | last post by:
Hi, I use the selectednodestyle with a white background so the user can see which item was chosen in the treeview navigation. The nodes have a navigateURL with a target to another frame. Navigating works with no postback and the style follow the selected node. When a new child is added to a node there is a button to refresh the node. This is done by a postback. After this postback the selected node stays keeps the selected style.
2
2250
by: Manikandan | last post by:
Hi, I'm using .NET1.1. I have a windows form with two controls 1.Treeview 2.Checkbox I added the items into tree view, the user selects the item in treeview. When i click the item in treeview it get selected(highlighted in blue color) .
4
3008
by: Xenomorph | last post by:
I have a program where you click an item on the TreeView on the left, and then work with whatever pops up on the right. There are many entries on the TreeView, and when you click something on the right, the item on the TreeView is no longer highlighted, making it hard to keep track of which item you clicked on the TreeView. I want the item clicked on in the TreeView to turn BOLD, or get underlined, or change color or something. Just so...
0
2169
by: bsturg21 | last post by:
Hello, I have an app that has a custom treeview which inherits the base treeview class and I am having a problem with the way the treeview is being redrawn. Each node in the treeview represents a folder, and this problem began when I added the functionality to have a ghost image of the folder when it is dragged and dropped to another location in the treeview. My code to create the ghost image is as follows: this.NodeToBeDeleted =...
0
3311
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. Provide following view properties to listview, through View menu a. Tile b. Icon
0
9422
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
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
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...
0
9857
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6662
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
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...
1
3952
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
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
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.