public void AddFirstSubType(TreeNode Ptn) { Ptn.Nodes.Clear(); List <PartType> FirstType = PartType.Find1STPartType(); foreach (PartType SP in FirstType) { TreeNode Subtn = new TreeNode(); Subtn.Tag = SP.TYPEID; Subtn.Text = SP.TYPE_DESC + "(" + SP.TYPE_NO + ")"; Subtn.ImageIndex = 4; Subtn.SelectedImageIndex = 4; List <PartType> SecondPro = PartType.Find2STPartType(SP.TYPEID); if (SecondPro.Count != 0) { Ptn.Nodes.Add(Subtn); foreach (PartType SSP in SecondPro) { TreeNode SSubtn = new TreeNode(); SSubtn.Name = "activity"; SSubtn.Tag = SSP.TYPEID; SSubtn.ImageIndex = 4; SSubtn.SelectedImageIndex = 4; SSubtn.Text = SSP.TYPE_DESC + "(" + SSP.TYPE_NO + ")"; Subtn.Nodes.Add(SSubtn); } } else { Subtn.Name = "activity"; Subtn.ImageIndex = 4; Subtn.SelectedImageIndex = 4; Ptn.Nodes.Add(Subtn); } Subtn.Expand(); } Ptn.Expand(); }