private void AddNewRootToolStripMenuItem_Click(object sender, EventArgs e) { frmEnterText frm = new frmEnterText(); frm.ShowDialog(); string TempNodeText = frm.Get_FormText(); frm.Dispose(); if (!string.IsNullOrEmpty(TempNodeText.Trim())) { TreeNode _Node = new TreeNode(); _Node.Text = TempNodeText; _Node.ContextMenuStrip = contextMenuStrip2; treeView1.Nodes.Add(_Node); } }
private void AddChildRootToolStripMenuItem_Click(object sender, EventArgs e) { string Id = ""; frmEnterText frm = new frmEnterText(); frm.ShowDialog(); string TempNodeText = frm.Get_FormText(); string TempGenderTxt = frm.Get_GenderText(); frm.Dispose(); if (!string.IsNullOrEmpty(TempNodeText.Trim())) { int i = Convert.ToInt32(treeView1.SelectedNode.Name); SaveNode(TempNodeText, TempGenderTxt, i); adapter.Fill(individual.Sections); DataRow[] selected = individual.Sections.Select("SectionName ='" + TempNodeText + "'"); foreach (DataRow row in selected) { Id = row["SectionID"].ToString(); } TreeNode _Node = new TreeNode(); _Node.Text = TempNodeText; _Node.Name = Id; _Node.ContextMenuStrip = contextMenuStrip2; if (TempGenderTxt == "F") { _Node.ImageIndex = 5; _Node.SelectedImageIndex = 5; } if (TempGenderTxt == "M") { _Node.ImageIndex = 4; _Node.SelectedImageIndex = 4; } treeView1.SelectedNode.Nodes.Add(_Node); } }
private void RenameToolStripMenuItem_Click(object sender, EventArgs e) { frmEnterText frm = new frmEnterText(); frm.ShowDialog(); string TempNodeText = frm.Get_FormText(); frm.Dispose(); TreeNode SelectedNode = treeView1.SelectedNode; int i = Convert.ToInt32(SelectedNode.Name); if (!string.IsNullOrEmpty(TempNodeText.Trim())) { DataRow[] selected = individual.Sections.Select("SectionID =" + i); foreach (DataRow row in selected) { row["SectionName"] = TempNodeText; } adapter.Update(individual.Sections); SelectedNode.Text = TempNodeText; } treeView1.EndUpdate(); }