By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,543 Members | 2,169 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,543 IT Pros & Developers. It's quick & easy.

VS 2005 Beta 2: Using TreeView control in SplitContainer to change the right panel

P: n/a
I have a TreeView control in the left panel of a SplitContainer. When I
click on various nodes in the TreeView I would like different sets of
buttons and textboxes to appear in the right panel. Is this doable?

Also, it seems that the TreeView nodes do not have a click event. Is that
correct?

Thanks,
J.S.

--
Nov 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
J.S.,

Yes, it is possible. The easiest way to do this would be to have the
different categories of controls laid out on panels which you set the
visibility of when the node is clicked.

In .NET 2.0 (which you are using), the TreeView class has the
NodeMouseClick event, which will give you the node that was clicked.

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

"J.S." <js*@nospam.com> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
I have a TreeView control in the left panel of a SplitContainer. When I
click on various nodes in the TreeView I would like different sets of
buttons and textboxes to appear in the right panel. Is this doable?

Also, it seems that the TreeView nodes do not have a click event. Is that
correct?

Thanks,
J.S.

--

Nov 17 '05 #2

P: n/a
Hi Nicholas,
Yes, it is possible. The easiest way to do this would be to have the
different categories of controls laid out on panels which you set the
visibility of when the node is clicked.
That should work for a few controls but it might be a problem if there are
dozens of TreeView nodes with each having several corresponding buttons,
textboxes, and comboboxes that need to be shown in the right panel.

I am looking to do something similar to what one can do with frames in a web
page. Can a Main Form have sub-forms such that clicking on Node1 in the
left panel would show subform1 in the right panel and Node2, subform2 and so
on?

I sort of managed to do perform the same functions by using tabcontrols
instead of treeview but I would prefer the latter option.
In .NET 2.0 (which you are using), the TreeView class has the
NodeMouseClick event, which will give you the node that was clicked.


Thanks!

J.S.

--
Nov 17 '05 #3

P: n/a
J.S.,

You can't do it with sub forms, but you can do it with panels. Just
slap all of the controls you need on separate panels, and then show/hide the
panels according to which node is clicked.

I assume you want forms so that you can use separate design surfaces for
each node. You can create a custom user control, and it will pretty much
give you the same thing.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"J.S." <js*@nospam.com> wrote in message
news:ek**************@TK2MSFTNGP12.phx.gbl...
Hi Nicholas,
Yes, it is possible. The easiest way to do this would be to have the
different categories of controls laid out on panels which you set the
visibility of when the node is clicked.


That should work for a few controls but it might be a problem if there are
dozens of TreeView nodes with each having several corresponding buttons,
textboxes, and comboboxes that need to be shown in the right panel.

I am looking to do something similar to what one can do with frames in a
web page. Can a Main Form have sub-forms such that clicking on Node1 in
the left panel would show subform1 in the right panel and Node2, subform2
and so on?

I sort of managed to do perform the same functions by using tabcontrols
instead of treeview but I would prefer the latter option.
In .NET 2.0 (which you are using), the TreeView class has the
NodeMouseClick event, which will give you the node that was clicked.


Thanks!

J.S.

--

Nov 17 '05 #4

P: n/a
Thanks, Nicholas! That's just what I was looking for.

J.S.

--

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uu**************@TK2MSFTNGP09.phx.gbl...
J.S.,

You can't do it with sub forms, but you can do it with panels. Just
slap all of the controls you need on separate panels, and then show/hide
the panels according to which node is clicked.

I assume you want forms so that you can use separate design surfaces
for each node. You can create a custom user control, and it will pretty
much give you the same thing.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

Nov 17 '05 #5

P: n/a
> slap all of the controls you need on separate panels, and then show/hide
the panels according to which node is clicked.
Nicholas, I thought the panels were just part of the SplitContainer and that
there was no separate panels control. However, your post seems to indicate
that one can have several panels, one of each node in the treeview control.
Or are you just referring to panels in the sense of groups of controls
programmtically grouped together to be hidden/shown based on the selection
of nodes in the treeview?
I assume you want forms so that you can use separate design surfaces
for each node. You can create a custom user control, and it will pretty
much give you the same thing.


Yes, that is exactly what I want to do. My left panel has dozens of nodes
in a treeview and in the right panel I'd like to show separate design
surfaces. I read somewhere that the listcontrol could be used in the right
panel but it doesn't seem to be the right control to show the kind of design
elements I need to show in the right panel.

Thanks,
J.S.
Nov 17 '05 #6

P: n/a
> slap all of the controls you need on separate panels, and then show/hide
the panels according to which node is clicked.
Nicholas, I thought the panels were just part of the SplitContainer and that
there was no separate panels control. However, your post seems to indicate
that one can have several panels, one of each node in the treeview control.
Or are you just referring to panels in the sense of groups of controls
programmtically grouped together to be hidden/shown based on the selection
of nodes in the treeview?
I assume you want forms so that you can use separate design surfaces
for each node. You can create a custom user control, and it will pretty
much give you the same thing.


Yes, that is exactly what I want to do. My left panel has dozens of nodes
in a treeview and in the right panel I'd like to show separate design
surfaces. I read somewhere that the listcontrol could be used in the right
panel but it doesn't seem to be the right control to show the kind of design
elements I need to show in the right panel.

Thanks,
J.S.
Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.