Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 14th, 2006, 01:57 AM
Authorized User
Join Date: Jul 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to select a node or text from treeview

Hi there

I am new to programming C# and programming in general so I am hoping you guys can help me.

I have to make a routine that connects a different data source to a data grid view using a treeview.

So I have to make a program with several if statements that selects a node or text. If a node with text “hello” is selected the data source should be X.

I hope my problem is clear en hope you can help me.



Old September 4th, 2006, 12:17 PM
Authorized User
Join Date: Sep 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts

Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As_
System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Label1.Text = "You are here->" & " " & e.Node.FullPath
'displaying the path of the selected node
Label2.Text = "Current node selected:" & " " & e.Node.Text
'displaying the selected node
End Sub

u can try this code.And Let me know if it works

Old September 4th, 2006, 12:18 PM
Authorized User
Join Date: Sep 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts

this code is in VB.Net.But U cand easily change it for c#

Old September 5th, 2006, 05:23 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma

Have a look at this discussion



Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically select a treeview node and expand simsen ASP.NET 2.0 Professional 0 June 23rd, 2008 01:57 AM
asp.net 2.0 treeview select node does not respond vhrao ASP.NET 2.0 Basics 0 February 17th, 2006 05:03 PM
Focusing on a node in a treeview (C# application) themuffinman_swe C# 5 November 27th, 2005 09:58 AM
Add node in ie treeview acko ASP.NET 1.x and 2.0 Application Design 0 January 28th, 2004 09:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.