VB 6.0 treeview control "How to make different nodes unvisible"

With the
 Set nod = .Nodes.Add(, , "key", "describtion")

I set different nodes for a treeview.
The tree I set when I load up the form.
Now my question:

When the user performs a certain comand I would like that
all items in nod 1 and all his children dissappear.

I tried
.Nodes("key").visible = false
but it comes up with an error message
"property read only"

What do I have to programme???
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

DabasConnect With a Mentor Commented:
Easiest way in my opinion is to clear the whole tree, and recreated it without the node.

You could keep a hidden tree or a tree like collection to duplicate your data while you are reconstructing it.

do you want to clear tree or do you want to hide all the nodes?
themrocAuthor Commented:
I would like to hide only one nod with all its children.
is it possible to do at run time???
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

No, you have to remove the nodes...
Here is a solution that may work for you:

Get new node
Retain all needed properties of older node (index, releative, parrents, key, etc.)
Delete older node
When you want to display it back the old node insert new node to the tree based on older's node properties that you retained.

Hope this helps you a little bit.
themrocAuthor Commented:
A little bit confusing,

how do I get a new node, is it the set node methode?

How do I retain all the needed properties?

do you have some coding?
Hi themroc,
It appears that you have forgotten to close this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept Dabas's comment(s) as an answer.

themroc, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
All Courses

From novice to tech pro — start learning today.