private void btnBNOk_Click(object sender, EventArgs e) { try { if (txtbname.Text.Length > 0) { m_sBname = txtbname.Text; this.Close(); parent = oMain.treeView1.SelectedNode; if (parent != null) { child = parent.Nodes.Add(m_sBname); child.ContextMenuStrip = oMain.PartInfo_contextMenuStrip; oMain.treeView1.ExpandAll(); PartInformation oPInfo = new PartInformation(parent, child); //child.ExpandAll(); } } else { MessageBox.Show("Name must be given, please Enter name"); } } catch (Exception ee) { MessageBox.Show(ee + ""); } }
private void addEditPartInfoToolStripMenuItem_Click(object sender, EventArgs e) { PartInformation opi = new PartInformation(oForm); opi.ShowDialog(); int index = 0; TreeNode AssNode = oForm.treeView1.SelectedNode; TreeNode SubAssNode = opi.child.TreeView.SelectedNode; if (index > 0) { dgvTolInfo.Visible = false; dgvPartInfo.Visible = false; gbOutput.Visible = false; gbDesignComments.Visible = false; gbGNComments.Visible = false; } else { dgvTolInfo.Visible = true; dgvPartInfo.Visible = true; gbOutput.Visible = true; gbDesignComments.Visible = true; gbGNComments.Visible = true; if (AssNode != null && SubAssNode != null) { dgvTolInfo.Rows.Clear(); foreach (PartInfo opinfo in opi.m_lsParts) { index = dgvTolInfo.Rows.Add(); dgvTolInfo[0, index].Value = (index + 1).ToString(); dgvTolInfo[1, index].Value = opinfo.m_sPTNum; dgvTolInfo[2, index].Value = opinfo.m_sUniTolPlus; dgvTolInfo[3, index].Value = opinfo.m_sUniTolMinus; } } //MessageBox.Show("index = " + index); } if (index >= 0) { PartInfo objpi = opi.m_lsParts[index]; dgvPartInfo.Rows.Clear(); string[] sArr1 = { "Part Number Number", "Dash Number", "Part Description", "Part Rev", "Tolerance Status", "Tolerance Source", "Nominal Dimension", "Diametral Tolerance", "Bonus Tolerance" }; string[] sArr2 = { objpi.m_sPTNum, objpi.m_sDashNum, objpi.m_sPTDesc, objpi.m_sPTRev, objpi.m_sTolStatus, objpi.m_sTolSource, objpi.m_sNominalDim, objpi.m_sDiametricTol, objpi.m_sBonusTol }; for (int i = 0; i <= sArr1.Length - 1; i++) { int index1 = dgvPartInfo.Rows.Add(); //ssageBox.Show("index1 = "+index1); dgvPartInfo[0, index1].Value = sArr1[index1]; dgvPartInfo[1, index1].Value = sArr2[index1]; } } }