AbdelMalek
AbdelMalek

Reputation: 2844

How to link windows forms with treeview in C sharp

I’d like to make a windows form and split it in to two parts vertically. The left side contains a tree view and the right side is empty at start. When I click on a node of the tree list, I want the right side to open a form or panel that I already made before. So basically, the tree list nodes is just a way for me to switch through the forms in the same window without opening a new window or leaving the same window. I already know how to make a treeview and the nodes but I’m not sure about how to make the right sides witch through the forms/panels that I made.

Upvotes: 0

Views: 2668

Answers (1)

SLaks
SLaks

Reputation: 887335

You can make a SplitContainerControl and add a custom UserControl to the right panel at runtime:

scc.Panel2.Controls.Add(new YourControl(...));

You could also add it in the designer and use the Visible property to hide it until later.

Either way, remember to set its Dock to Fill.

Upvotes: 1

Related Questions