Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How to make tree node (is Expanded, is Visible, Last node, Level, Next Node, Next Visible Node) using “Tree Node class” in VB and C# (.net 2.0). Part 3

Author: Zunnair
Download Source Code : 894_Tree Node.zip

In this simple article you will learn that how we can make a tree node and set node properties using “Tree Node class” in VB and C# .net 2.0.

 

To understand this article more read the part1 and part2 of this article.
Is Expanded:
If you want to know that the node is expanded or not for this purpose we have a property named is expanded. This property returns the Boolean value. If value is true then it means that node is expanded other wise not expanded.
Now write the following code.
C#
bool b;
b = obj.IsExpanded;
string str;
str = b.ToString();
MessageBox.Show(str);
VB
Dim b As Boolean
b = obj. IsExpanded
Dim str As String
str = b.ToString()
MessageBox.Show(str)
This simple code gets that node is expanded or not.
Is Visible:
If you want to know that the node is visible or partially visible for this purpose we have a property named is visible. This property returns the Boolean value. If value is true then it means that node is visible other wise partially visible.
Now write the following code.
C#
bool b;
b = obj.IsVisible;
string str;
str = b.ToString();
MessageBox.Show(str);
VB
Dim b As Boolean
b = obj.IsVisible
Dim str As String
str = b.ToString()
MessageBox.Show(str)
This simple code gets that node is visible or partially visible.
Last Node:
If you want to get the last child node of a particular node, for this purpose we have a property named last node. This property returns the object of tree node class. This object has the information about the last child node.
Write the following code.
C#
TreeNode last = new TreeNode();
last = obj.LastNode;
string str;
str = last.Name;
MessageBox.Show(str);
 
VB
 
Dim last As New TreeNode()
last = obj.LastNode
Dim str As String
str = last.Name
MessageBox.Show(str)
This simple code gets the last node child of a particular node.
Level of Node:
If you want to get the level of a particular node for this purpose we have a property named level. This property returns the integer which tells the level.
Now write the following code.
C#
int level;
level = obj.Level;
string str;
str = level.ToString();
MessageBox.Show(str);
VB
Dim level As Integer
level = obj.Level
Dim str As String
str = level.ToString()
MessageBox.Show(str)
This simple code gets the level of a code.
Next Node:
If you want to know the next node from the particular node for this purpose we have a property named next node. This property returns the object of tree node class. This object has the information about the next node.
Now write the following code.
C#
TreeNode nx = new TreeNode();
nx = obj.NextNode;
string str;
str = nx.NextNode;
MessageBox.Show(str);
VB
Dim nx As New TreeNode()
nx = obj.NextNode
Dim str As String
str = nx.Name
MessageBox.Show(str)
This simple code gets the next node from a particular node.
Next Visible Node:
If you want to know the next visible node from the particular node for this purpose we have a property named next visible node. This property returns the object of tree node class. This object has the information about the next visible node.
Now write the following code.
C#
TreeNode nxv = new TreeNode();
nx = obj.NextVisibleNode;
string str;
str = nx.NextVisibleNode;
MessageBox.Show(str);
VB
Dim nxv As New TreeNode()
nxv = obj.NextVisibleNode
Dim str As String
str = nxv.Name
MessageBox.Show(str)
This simple code gets the next visible node from a particular node.
Now write the following code on FORM LOAD event:
C#
private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "DEVASP TREE NODE APPLICATION";
        }     
VB
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Me.Text = "DEVASP TREE NODE APPLICATION"
    End Sub
 
This simple article tells that how we can make a tree node and set node properties using “Tree Node class” in VB and C# .net 2.0.
   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to make tree node (Full path, Back color, checked, is Editing, is Selected) using “Tree Node class” in VB and C# (.net 2.0). Part 2

Disclaimer - Privacy
© 2002-2017 DevASP.net