예제 #1
0
        private void f_Load_Tree()
        {
            treeView1.Nodes.Clear();
            TreeNode anode, anode1;
            DataSet  adsloai, adsgia;

            adsgia  = m_v.f_get_v_giavp_frmgiavp();
            adsloai = m_v.f_get_v_loaivp_frmgiavp();
            foreach (DataRow r in adsloai.Tables[0].Rows)
            {
                anode     = new TreeNode(r["ten"].ToString());
                anode.Tag = r["id"].ToString() + ":?";
                treeView1.Nodes.Add(anode);
                foreach (DataRow r1 in adsgia.Tables[0].Select("id_loai=" + r["id"].ToString()))
                {
                    anode1     = new TreeNode(r1["ten"].ToString());
                    anode1.Tag = r1["id"].ToString();
                    anode.Nodes.Add(anode1);
                    //treeView1.SelectedNode = anode1;
                }
            }
            //treeView1.ExpandAll();
        }