473,382 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to take off the minus button of a TreeNode?

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.

Aug 21 '06 #1
4 1688
Hi,
You can set the property "showplusminus" to false to hide ALL the plus
and minus signs,

HTH,
James.

osmarjunior wrote:
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.
Aug 21 '06 #2
Hi again,
A better way to test if it is the root would be

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

Cheers,
James.

osmarjunior wrote:
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.
Aug 21 '06 #3

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.

pigeonrandle escreveu:
Hi again,
A better way to test if it is the root would be

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

Cheers,
James.

osmarjunior wrote:
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.
Aug 21 '06 #4
In which case, i'm glad i couldn't help :o)

osmarjunior wrote:
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.

pigeonrandle escreveu:
Hi again,
A better way to test if it is the root would be

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

Cheers,
James.

osmarjunior wrote:
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.
Aug 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Benny Raymond | last post by:
More problems with this... When I run this code, the main form returns an invalid cast exception as it's executing the line "TreeNode n = (TreeNode) this.Nodes;" Does anyone know what would...
0
by: naija naija | last post by:
Hi All, I'm using the TreView Web Control for my MENU. And the Menu is populated from an XML file below. I want a way in which i can manipulate the XML when i want to manage it without having to...
3
by: markaelkins | last post by:
Hi. I am trying to enter a variable in the treenodesrc of a treenode. I am basically trying to send an ID variable into sql to return different records. I've searched everywhere and cannot find the...
2
by: bclegg | last post by:
Hi, When I implement the example code it errors with 'No parameterless constructor defined for this object.' experimenting with dim o as object = mytreenode.clone() gives the same error. The...
2
by: garyusenet | last post by:
I could do with something similiar, can you tell me if you think this would work for me, and if there's any advantage in working with controls this way than how I currently am. At the moment...
3
by: tanya foster | last post by:
Hello, I am re-writing a visual basic .net application(visual studio 2003) in an asp.net application(visual studio 2005). The vb.net application relied on a treeview and hence, treenodes. The...
0
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. ...
1
by: jmDesktop | last post by:
I am trying to add nodes with keys to my treeview. I can add general nodes without problem with: //create new node TreeNode newNode = new TreeNode(myIdNumber); //create children TreeNode...
1
by: AAaron123 | last post by:
If you see this posted twice - sorry. My news reader showed my first post as "No Longer Available" I have the following in a .css file. The treeNodes behave as if they were "a" elements. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.