473,612 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Expanding a tree view with a path

I have a tree view with a root, 3 noodes(1,2,3) each having one sub node.

I drill down to a node.

I get the path by saying treeView1.selec tedNode.fullpat h and assign it to a
variable.

If I redraw the tree, or close it up and want to expand the same node again,
can i do this via the path?

Thank you kindly.
Feb 3 '06 #1
4 11960
James,

This seems a little more complicated than it should have to be.

Basically, what you have to do is parse apart the full path, delimited
by the value in the PathSeparator property. Then, you would take Nodes
property on the TreeView, and look for the first key (through the IndexOfKey
method). Then, you take that node, and look for the next key in the
collection of TreeNode instances returned from Node.

Once you have the final node, you can call the EnsureVisible method on
the last node, and then it will expose the node in the tree.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:1F******** *************** ***********@mic rosoft.com...
I have a tree view with a root, 3 noodes(1,2,3) each having one sub node.

I drill down to a node.

I get the path by saying treeView1.selec tedNode.fullpat h and assign it to
a
variable.

If I redraw the tree, or close it up and want to expand the same node
again,
can i do this via the path?

Thank you kindly.

Feb 3 '06 #2
I cannot seem to see an index of key mathod or an ensure visible method.
I have this so far.

string path = treeView1.Selec tedNode.FullPat h;
string delimit = @"\";
char [] delimiter = delimit.ToCharA rray();
string [] split = null;

split = path.Split( delimiter );

int treeNodeIndex;
TreeNode t = new TreeNode( split[0].ToString());
treeNodeIndex= treeView1.Nodes[0].Nodes.IndexOf( t );

thanks
"Nicholas Paldino [.NET/C# MVP]" wrote:
James,

This seems a little more complicated than it should have to be.

Basically, what you have to do is parse apart the full path, delimited
by the value in the PathSeparator property. Then, you would take Nodes
property on the TreeView, and look for the first key (through the IndexOfKey
method). Then, you take that node, and look for the next key in the
collection of TreeNode instances returned from Node.

Once you have the final node, you can call the EnsureVisible method on
the last node, and then it will expose the node in the tree.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:1F******** *************** ***********@mic rosoft.com...
I have a tree view with a root, 3 noodes(1,2,3) each having one sub node.

I drill down to a node.

I get the path by saying treeView1.selec tedNode.fullpat h and assign it to
a
variable.

If I redraw the tree, or close it up and want to expand the same node
again,
can i do this via the path?

Thank you kindly.


Feb 3 '06 #3
James,

You have to call the IndexOfKey method, passing the current element in
split that you are looking at.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
I cannot seem to see an index of key mathod or an ensure visible method.
I have this so far.

string path = treeView1.Selec tedNode.FullPat h;
string delimit = @"\";
char [] delimiter = delimit.ToCharA rray();
string [] split = null;

split = path.Split( delimiter );

int treeNodeIndex;
TreeNode t = new TreeNode( split[0].ToString());
treeNodeIndex= treeView1.Nodes[0].Nodes.IndexOf( t );

thanks
"Nicholas Paldino [.NET/C# MVP]" wrote:
James,

This seems a little more complicated than it should have to be.

Basically, what you have to do is parse apart the full path,
delimited
by the value in the PathSeparator property. Then, you would take Nodes
property on the TreeView, and look for the first key (through the
IndexOfKey
method). Then, you take that node, and look for the next key in the
collection of TreeNode instances returned from Node.

Once you have the final node, you can call the EnsureVisible method
on
the last node, and then it will expose the node in the tree.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:1F******** *************** ***********@mic rosoft.com...
>I have a tree view with a root, 3 noodes(1,2,3) each having one sub
>node.
>
> I drill down to a node.
>
> I get the path by saying treeView1.selec tedNode.fullpat h and assign it
> to
> a
> variable.
>
> If I redraw the tree, or close it up and want to expand the same node
> again,
> can i do this via the path?
>
> Thank you kindly.


Feb 3 '06 #4
As i said earlier, i cannot see these methods you are refering to anywhere.
Is this a .net2 feature?

"Nicholas Paldino [.NET/C# MVP]" wrote:
James,

You have to call the IndexOfKey method, passing the current element in
split that you are looking at.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
I cannot seem to see an index of key mathod or an ensure visible method.
I have this so far.

string path = treeView1.Selec tedNode.FullPat h;
string delimit = @"\";
char [] delimiter = delimit.ToCharA rray();
string [] split = null;

split = path.Split( delimiter );

int treeNodeIndex;
TreeNode t = new TreeNode( split[0].ToString());
treeNodeIndex= treeView1.Nodes[0].Nodes.IndexOf( t );

thanks
"Nicholas Paldino [.NET/C# MVP]" wrote:
James,

This seems a little more complicated than it should have to be.

Basically, what you have to do is parse apart the full path,
delimited
by the value in the PathSeparator property. Then, you would take Nodes
property on the TreeView, and look for the first key (through the
IndexOfKey
method). Then, you take that node, and look for the next key in the
collection of TreeNode instances returned from Node.

Once you have the final node, you can call the EnsureVisible method
on
the last node, and then it will expose the node in the tree.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:1F******** *************** ***********@mic rosoft.com...
>I have a tree view with a root, 3 noodes(1,2,3) each having one sub
>node.
>
> I drill down to a node.
>
> I get the path by saying treeView1.selec tedNode.fullpat h and assign it
> to
> a
> variable.
>
> If I redraw the tree, or close it up and want to expand the same node
> again,
> can i do this via the path?
>
> Thank you kindly.


Feb 6 '06 #5

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

Similar topics

3
10813
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?
1
4991
by: serge calderara | last post by:
Dear all, I have the configuration part of my application which will handle different element configuartion based on tree view object similar as MMC and snap in. Configuration data are retrive and save in a local database for each component. What is the best way to populate my tree view control.
4
2682
by: erikd | last post by:
I'm using an expanding tree menu based on the design from Dieter Bungers GMD (www.gmd.de) and infovation (www.infovation.de) named displayToc.js. The problem is that the script isn't working properly in Firefox, although it's working without problems in IE 5.5 & 6.0 In Firefox any file which isn't in the same directory isn't found, so the images are missing and the links don't launch. It may be something simple, but I don't have the...
2
1738
by: weston | last post by:
So, I'm attempting to code an expanding tree menu, based off of unordered lists containing unordered lists. I'm also trying to do it in such a way that none of the javascript has to go inline with the markup: http://weston.canncentral.org/misc/webgallery/FMH/template.html So far, so good. It seems to work in Gecko-based browsers rather well (mouse-over "Online Services" to see it work).
7
10345
by: Andrew Robinson | last post by:
I have a treeview control that I use as a menu & navigation control within a master page. The nodes for this control are loaded from a database which contains the text and url of each like and the hierarchy of the menu tree. All pretty normal stuff. Is there any simple method of maintaining the expanded / collapsed state of each node as my application moves from page to page? Remember this is on a master page used by numerous content...
3
2774
by: Stefan Schwarzer | last post by:
Hello, from time to time I want to inspect the source code of projects on remote computers.(*) I've googled for one or two hours but didn't find anything helpful. :-/ I'm looking for something like IDLE's path browser - i. e. a tree view and file view side-by-side - but with the following differences: - doesn't need an X connection to the remote computer where the sources are
0
1031
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
Hi, I want to develop a web service client (windows form) that receives an XML file which describes a local file substructure rooted from a path. The client will use tree control generated by the XML file such that control nodes map to the XML nodes. From tree view control node navigation, we can get XML node and path that we want. Any one knows a tutorial about it?
1
2950
by: =?Utf-8?B?UHJhZGVlcCBFYXJsYQ==?= | last post by:
Hi I am having one windows application on my local machine and I want to display the folders(shared folders) of remote machine in tree view control of my win application. I haved added me as administartor in that remote machine. The following is my requirement. 1)The Application should show a tree view and a list view. 2) Tree view should show the folder structure and List view should list the
7
4756
by: chaitrabharadwa | last post by:
hi all, I have a treeview and the picturebox in the form. i have a tree view which have icons for each node. i have imagelist which loads icons for nodes in the treeview. some image will be loaded in the picturebox. the user has to drag and drop the icon from the treeview on to the image in the picturebox. when the form is closed, the icons that are dragged and dropped on to the image sud be save.the co-ordinates of the icons on the image sud...
0
8159
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
8101
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
8564
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
8415
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
5530
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
4044
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
2548
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
1
1694
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1413
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.