Click here to Skip to main content
15,889,838 members
Articles / Programming Languages / XML

Working with TreeView Controls

Rate me:
Please Sign up or sign in to vote.
4.71/5 (26 votes)
22 Jan 2008CPOL8 min read 196.3K   9.8K   81  
An article about working with TreeView controls
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace EasyTreeView
{
    public partial class NewNode : Form
    {
        
#region Local Variables

        private string mNewNodeName;
        private string mNewNodeText;
        private string mNewNodeTag;


#endregion


        /// <summary>
        /// Default constructor
        /// </summary>
        public NewNode()
        {
            InitializeComponent();
        }



#region Class Properties

        public string NewNodeName
        {
            get
            {
                return mNewNodeName;
            }
            set
            {
                mNewNodeName = value;
            }
        }

        public string NewNodeText
        {
            get
            {
                return mNewNodeText;
            }
            set
            {
                mNewNodeText = value;
            }
        }


        public string NewNodeTag
        {
            get
            {
                return mNewNodeTag;
            }
            set
            {
                mNewNodeTag = value;
            }
        }

        
#endregion



        private void btnSubmit_Click(object sender, EventArgs e)
        {

            if (txtNewNodeName.Text != string.Empty)
            {
                NewNodeName = txtNewNodeName.Text;
            }
            else
            {
                MessageBox.Show("Name the node.");
                return;
            }

            if (txtNewNodeText.Text != string.Empty)
            {
                NewNodeText = txtNewNodeText.Text;
            }
            else
            {
                MessageBox.Show("Provide the new node's text");
                return;
            }

            if (txtTag.Text != string.Empty)
            {
                NewNodeTag = txtTag.Text;
            }
            else
            {
                MessageBox.Show("Provide the new node's text");
                return;
            }

            this.Close();
        }



    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions