Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 August 16th, 2005, 04:50 AM
Authorized User
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dotnetprogrammer
Default TreeView - Please help

I have a treeview on my form. Now I need to assciate a Form object
with each node of the tree. The idea is whenever user clicks on a node,
then the currenly opened form (if any ) is closed and the form associated
with that node is opened.

How can I do that.
Actually I have to develop a custom control with a treeview which can also take an Form Object with every node. Idea is to when we click on the treeview, we will show that form and hide the last one.

Any kind of help will be greatly appreciated.


Old September 5th, 2005, 09:02 AM
Friend of Wrox
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post

You can define a class which inherits from the TreeNode class. Your derived class can contain whatever information you need, and implement whatever properties and methods are appropriate, such as references to forms or whatever. Since these objects derive from TreeNode, they can be placed in the treeview and will behave just like TreeNodes, which, of course, is what they are.

You can then determine the selected node, and DirectCast it to your derived type. You can then retrieve whatever custom properties you have defined in your class and have it take appropriate action.

Jeff Mason
Custom Apps, Inc.

Similar Threads
Thread Thread Starter Forum Replies Last Post
treeview mahmutmol ASP.NET 2.0 Professional 0 August 21st, 2006 06:46 AM
treeview mahmutmol ASP.NET 2.0 Basics 0 August 21st, 2006 06:43 AM
treeview SAIGORTI SQL Language 2 September 6th, 2005 07:31 PM
Treeview dkr72 VBScript 0 November 9th, 2004 12:07 PM
treeview MANOJMETAL ADO.NET 1 April 17th, 2004 08:46 AM

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