Arun Kurmi

Arun Kurmi

  • NA
  • 104
  • 101.6k

TreeView Control in C#

Mar 8 2013 2:33 AM
hi friends,

(1) In below code how to add day node.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace msg
{
    public partial class TreeViewControl : Form
    {
        public TreeViewControl()
        {
            InitializeComponent();
        }

        private void TreeViewControl_Load(object sender, EventArgs e)
        {
          //System.Globalization.DateTimeFormatInfo d = new System.Globalization.DateTimeFormatInfo();
            DateTimeFormatInfo d = new DateTimeFormatInfo();
            for (int yearnum = 1989; yearnum <= 2013; yearnum++)
            {
                TreeNode yearnode = new TreeNode();
                yearnode.Text = yearnum.ToString();
                treeView1.Nodes.Add(yearnode);
                
                for (int monthnum = 0; monthnum < 12; monthnum++)
                {
                    TreeNode monthnode = new TreeNode();
                    //monthnode.Text = monthnum.ToString();
                    //monthnode.Text=DateTimeFormatInfo.CurrentInfo.MonthNames[monthnum].ToString();
                    monthnode.Text =d.MonthNames[monthnum].ToString();
                    yearnode.Nodes.Add(monthnode);
                }
            }
        }
    }
}

(2) where i found complete hierarchy of namespace their class and their methods and properties because sometimes i faced problem "You are missing directive or an assembly reference ".

Answers (2)