473,328 Members | 1,439 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,328 software developers and data experts.

access and modify a certain node in a tree view

8
hi,
ive created a certain tree view, which i want to modify (in run time)
on a certain button click.
how can i change a certain node label name and how can i change its image (assume i have images in a image list)

thanks!
Mar 14 '09 #1
3 1658
tlhintoq
3,525 Expert 2GB
Assuming your tree control is named "EventTree" this is how you make a new node
Expand|Select|Wrap|Line Numbers
  1.             TreeNode mainNode = new TreeNode();
  2.             mainNode.Name = "mainNode";
  3.             mainNode.Text = DateTime.Now.ToShortDateString();
  4.             EventTree.Nodes.Add(mainNode);
  5.  
To change an existing node:
Make a new node
Find the old node
Set the old node to the new node you just made
Mar 14 '09 #2
mbh1
8
how can i find the old one?
every node has it own index?
suppose i want to reach a certain node (a certain index) how can i do it?
thanks
Mar 14 '09 #3
tlhintoq
3,525 Expert 2GB
Read up on the TreeView control. The experiment a little: Its the best way to learn.

A common technique is to just check each node recursively to see if it is the text you are looking for. HINT: foreach(TreeNode tn in MyTreeView.Nodes)

Visual Studio has a built in search feature under the 'Help' menu that comes in handy for finding this stuff on MSDN. And if that is too dry to read, Google will show you a lot of other Tutorials and How-To's.

Mar 14 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Frnak McKenney | last post by:
Back when computer dinosaurs roamed the earth and the precursors to today's Internet were tiny flocks of TDMs living symbiotically with the silicon giants, tracking access to data processing...
2
by: Piet | last post by:
Hi there, I have managed to write a small java program that display an xml file in a JTree. This was achieved by defining a suitable tree model. THe program works...somehow. The nodes (elements...
0
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...
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...
3
by: Brian Henry | last post by:
If i already have a tree view created, and want to add another new node to it, how would i do so? Is there a way to throught tags or anything? like i have this RootNode | +-- Child 1 +--...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
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...
1
by: BeginingOfLife | last post by:
i am using a java script to create a tree view in my html page. i got that script from this link : http://destroydrop.com/javascripts/tree/ given script is static script creations for tree...
12
by: minimalniemand | last post by:
I try to recursivley fill a treeview from a xml-file. It works well, when the contents of the xml and the treeview match 1:1. code here: http://mad-scientists.co.uk/micha/shownode.txt a sample...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.