How to show the corresponding nodes of a treeView in a listView? Is it simply by comparing the node->Text and the items->Text? And how to delete the corresponding item?

Or the way is complicated to find out that these 2 items are corresponding?


Anyway, what's the different between items and subitems? I still don't get it.


I tried to add a node to treeView in Form1 from a button on Form2. After several nodes were successful, I quit from the application and try to develop another part.

When I start the application again, the nodes are GONE. Why it can be like that and how to solve it?

Do you know how to set paper type/size before printing? I have to print the listView items on an A4 paper. Is it just simply print the items and subitems?

And how to use a print component? Do I need printDialog and printDocument only? Or is there anything else? If it possible, please give me the code sample of how to use the print component.

Thank you very much.

What language/environment are you trying to work in (standard C/C++, Windows, Mac, C#, Delphi, other???). If it's anything besides C/++, Windows, Linux, or other C/C++ related specialty environments then there may be a better forum to ask these questions in. If it's Windows/Linux then the number of respondents familiar/comfortable with those environments at this forum is significantly fewer and answers take significantly longer in coming. Listing which language/environment you're using would be the first step in getting answers to most of the questions you've asked.

I can probably answer one question though:

"After several nodes were successful, I quit from the application and try to develop another part.

When I start the application again, the nodes are GONE. Why it can be like that and how to solve it?"

It's gone because while working with the program you are using RAM memory. Once you close the program everything in RAM is erased and not retrievable again. If you want to retrieve information from a previous run of the program you need to load it into the harddrive or other ong term memory area of the computer in the form of a file when you leave the program. Then when you come back to the program you have to load the information from the file in long term memory back into RAM.

Less dogmatically, node->Text and item->Text both sound like they will be of the same type, which is probably some form of string, but whether that string is a C style string, an AnsiString, or some other string type I can't say. You can probably compare them directly using an appropriate string comparison method.

Even more nebulous, both trees and lists are usually based on compound data structures of user defined type. I suspect the environment you are working in calls the basic data structure for a tree a node and for a list an item, though many times the term node is used to describe both. I'm not sure how you would directly correlate a given node from a tree to a given item in a list, however. Generally there is no direct one to one correlation. You can certainly generate a list of nodes from a tree, but it will vary depending on how you traverse the tree, you can "sort" the items of a list using a tree and you can equate a node and an item using the data stored in the item/node, but that's the best I can think of. Since lists are nonbranching structures and trees are branching structures, the equating of a given node from one to the other in a physical sense will be difficult.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.