Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

How to take off the minus button of a TreeNode?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
osmarjunior - 21 Aug 2006 14:22 GMT
I want to prevent a TreeNode to be collapsed, so I do the following, in
the BeforeCollapse event:

// Verify if it is the root node
if (e.Node.Name == "0")
 e.Cancel = true;

It works ok, but is there a way to not display the minus button?

Regards.

Junior.
pigeonrandle - 21 Aug 2006 14:25 GMT
Hi,
You can set the property "showplusminus" to false to hide ALL the plus
and minus signs,

HTH,
James.

> I want to prevent a TreeNode to be collapsed, so I do the following, in
> the BeforeCollapse event:
[quoted text clipped - 8 lines]
>
> Junior.
pigeonrandle - 21 Aug 2006 14:27 GMT
Hi again,
A better way to test if it is the root would be

if (e.Node == ((TreeView)sender).Nodes[0])

Cheers,
James.

> I want to prevent a TreeNode to be collapsed, so I do the following, in
> the BeforeCollapse event:
[quoted text clipped - 8 lines]
>
> Junior.
osmarjunior - 21 Aug 2006 14:34 GMT
Actually, I just wanna take off the minus button from the first node,
not from all nodes.
But your answer has taken me to another property of the TreeView:
ShowRootLines.
I set it to false, and I got what I want.

Thanks.

> Hi again,
> A better way to test if it is the root would be
[quoted text clipped - 16 lines]
> >
> > Junior.
pigeonrandle - 21 Aug 2006 14:41 GMT
In which case, i'm glad i couldn't help :o)

> Actually, I just wanna take off the minus button from the first node,
> not from all nodes.
[quoted text clipped - 24 lines]
> > >
> > > Junior.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.