private void btnNew_Click(object sender, System.EventArgs e)
        {
            string strMax = "";
            string strMin = "";
            string strId  = "";
            double dblMin = 0;

            //get the last id if there is one
            if (this.lstTreeDiam.Items.Count > 0)
            {
                strId  = Convert.ToString(Convert.ToInt16(this.lstTreeDiam.Items[this.lstTreeDiam.Items.Count - 1].Text) + 1);
                strMin = this.lstTreeDiam.Items[this.lstTreeDiam.Items.Count - 1].SubItems[2].Text;
                if (strMin.IndexOf(".") < 0)
                {
                    strMin += ".0";
                }

                dblMin = Convert.ToDouble(strMin) + 0.1;
                strMin = Convert.ToString(dblMin);

                strMax = strMin;
                //if (strMin.IndexOf(".") < 0) strMin += ".0";
            }
            else
            {
                strMax = "0.0";
                strMin = "0.0";
                strId  = "1";
            }

            FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog();
            frmTemp.MaximizeBox = false;
            frmTemp.BackColor   = System.Drawing.SystemColors.Control;
            frmTemp.Text        = "Database: Tree Diameter Groups (New)";
            frmTemp.Initialize_Plot_Tree_Diam_Edit_User_Control();

            frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtGroupId         = strId;
            frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter = strMax;
            frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter = strMin;


            //frmTemp.MdiParent = this;
            //frmTemp.Initialize_Plot_Tree_Diam_User_Control();


            frmTemp.Height = 0;
            frmTemp.Width  = 0;
            if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height > frmTemp.ClientSize.Height + 2)
            {
                for (int x = 1;; x++)
                {
                    frmTemp.Height = x;
                    if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top +
                        frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height <
                        frmTemp.ClientSize.Height)
                    {
                        break;
                    }
                }
            }
            if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width > frmTemp.ClientSize.Width + 2)
            {
                for (int x = 1;; x++)
                {
                    frmTemp.Width = x;
                    if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left +
                        frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width <
                        frmTemp.ClientSize.Width)
                    {
                        break;
                    }
                }
            }
            frmTemp.Left            = 0;
            frmTemp.Top             = 0;
            frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            frmTemp.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
            System.Windows.Forms.DialogResult result = frmTemp.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                strMax = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter.Trim();
                //remove the period if it is the last character
                if (strMax.IndexOf(".") == strMax.Length - 1)
                {
                    strMax = strMax.Replace(".", "");
                }
                strMin = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter.Trim();
                //remove the period if it is the last character
                if (strMin.IndexOf(".") == strMin.Length - 1)
                {
                    strMin = strMin.Replace(".", "");
                }
                this.lstTreeDiam.BeginUpdate();
                System.Windows.Forms.ListViewItem listItem = new ListViewItem();
                listItem.Text = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtGroupId;
                listItem.SubItems.Add(strMin);
                listItem.SubItems.Add(strMax);
                listItem.SubItems.Add(strMin + " - " + strMax);
                this.lstTreeDiam.Items.Add(listItem);
                this.lstTreeDiam.EndUpdate();
                if (this.btnSave.Enabled == false)
                {
                    this.btnSave.Enabled = true;
                }
            }
            frmTemp.Close();
            frmTemp.Dispose();
            frmTemp = null;
        }
        private void btnEdit_Click(object sender, System.EventArgs e)
        {
            string strMax = "";
            string strMin = "";
            string strId  = "";

            if (this.lstTreeDiam.SelectedItems.Count == 0)
            {
                return;
            }



            strId  = this.lstTreeDiam.SelectedItems[0].Text;
            strMin = this.lstTreeDiam.SelectedItems[0].SubItems[1].Text;
            strMax = this.lstTreeDiam.SelectedItems[0].SubItems[2].Text;
            if (strMin.IndexOf(".") < 0)
            {
                strMin += ".0";
            }
            if (strMax.IndexOf(".") < 0)
            {
                strMax += ".0";
            }

            FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog();
            frmTemp.MaximizeBox = false;
            frmTemp.BackColor   = System.Drawing.SystemColors.Control;
            frmTemp.Text        = "Database: Tree Diameter Groups (Edit)";
            frmTemp.Initialize_Plot_Tree_Diam_Edit_User_Control();

            frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtGroupId         = strId;
            frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter = strMax;
            frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter = strMin;


            frmTemp.Height = 0;
            frmTemp.Width  = 0;
            if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height > frmTemp.ClientSize.Height + 2)
            {
                for (int x = 1;; x++)
                {
                    frmTemp.Height = x;
                    if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top +
                        frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height <
                        frmTemp.ClientSize.Height)
                    {
                        break;
                    }
                }
            }
            if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width > frmTemp.ClientSize.Width + 2)
            {
                for (int x = 1;; x++)
                {
                    frmTemp.Width = x;
                    if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left +
                        frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width <
                        frmTemp.ClientSize.Width)
                    {
                        break;
                    }
                }
            }
            frmTemp.Left            = 0;
            frmTemp.Top             = 0;
            frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            frmTemp.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
            System.Windows.Forms.DialogResult result = frmTemp.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                strMax = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter.Trim();
                //remove the period if it is the last character
                if (strMax.IndexOf(".") == strMax.Length - 1)
                {
                    strMax = strMax.Replace(".", "");
                }
                strMin = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter.Trim();
                //remove the period if it is the last character
                if (strMin.IndexOf(".") == strMin.Length - 1)
                {
                    strMin = strMin.Replace(".", "");
                }
                this.lstTreeDiam.BeginUpdate();
                this.lstTreeDiam.SelectedItems[0].SubItems[1].Text = strMin;
                this.lstTreeDiam.SelectedItems[0].SubItems[2].Text = strMax;
                this.lstTreeDiam.SelectedItems[0].SubItems[3].Text = strMin + " - " + strMax;
                this.lstTreeDiam.EndUpdate();
                if (this.btnSave.Enabled == false)
                {
                    this.btnSave.Enabled = true;
                }
            }
            frmTemp.Close();
            frmTemp.Dispose();
            frmTemp = null;
        }
        private void ReadOnlyListStruc()
        {
            string strLargestString = "";
            string str = "";
            int    x   = 0;

            FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog();
            frmTemp.uc_select_list_item1.listBox1.Font = new System.Drawing.Font("Courier New", 8);
            frmTemp.Text = "Table Structure";

            frmTemp.uc_select_list_item1.lblMsg.Text    = "Table structure of " + this.m_table.TableName;
            frmTemp.uc_select_list_item1.lblMsg.Visible = true;

            frmTemp.uc_select_list_item1.Dock = System.Windows.Forms.DockStyle.Fill;

            frmTemp.uc_project1.Visible = false;
            frmTemp.uc_select_list_item1.listBox1.Items.Clear();
            //list the header information
            utils p_utils = new utils();

            //print header information
            //dataset name
            p_utils.LoadStringToCharArray("Structure For DataSet:", ref this.m_printheader.chrLabel, true, 0);
            p_utils.LoadStringToCharArray("  ", ref this.m_printheader.chrFiller, true, 0);
            p_utils.LoadStringToCharArray(this.m_table.TableName, ref this.m_printheader.chrDesc, true, 0);
            p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrLabel, false);
            p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrFiller, false);
            p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrDesc, false);
            frmTemp.uc_select_list_item1.listBox1.Items.Add(str);
            strLargestString = str.Trim();

            //number of records
            str = "";
            p_utils.LoadStringToCharArray("Number Of Records:", ref this.m_printheader.chrLabel, true, 0);
            p_utils.LoadStringToCharArray("  ", ref this.m_printheader.chrFiller, true, 0);
            p_utils.LoadStringToCharArray(this.m_table.Rows.Count.ToString(), ref this.m_printheader.chrDesc, true, 0);
            p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrLabel, true);
            p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrFiller, false);
            p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrDesc, false);
            frmTemp.uc_select_list_item1.listBox1.Items.Add(str);
            if (str.Trim().Length > strLargestString.Trim().Length)
            {
                strLargestString = str.Trim();
            }

            //field information column headers
            p_utils.LoadStringToCharArray("Field", ref this.m_printfield.chrFieldNumber, true, 0);
            p_utils.LoadStringToCharArray("   ", ref this.m_printfield.chrFiller, true, 0);
            p_utils.LoadStringToCharArray("Field Name", ref this.m_printfield.chrFieldName, true, 0);
            p_utils.LoadStringToCharArray("   ", ref this.m_printfield.chrFiller2, true, 0);
            p_utils.LoadStringToCharArray("Type", ref this.m_printfield.chrFieldType, true, 0);
            p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldNumber, true);
            p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller, false);
            p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldName, false);
            p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller2, false);
            p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldType, false);
            frmTemp.uc_select_list_item1.listBox1.Items.Add(str);
            if (str.Trim().Length > strLargestString.Trim().Length)
            {
                strLargestString = str;
            }

            //detail
            for (x = 0; x <= this.m_table.Columns.Count - 1; x++)
            {
                p_utils.LoadStringToCharArray(Convert.ToString(x + 1), ref this.m_printfield.chrFieldNumber, true, 0);
                p_utils.LoadStringToCharArray("   ", ref this.m_printfield.chrFiller, true, 0);
                p_utils.LoadStringToCharArray(this.m_table.Columns[x].ColumnName.ToString(), ref this.m_printfield.chrFieldName, true, 0);
                p_utils.LoadStringToCharArray("   ", ref this.m_printfield.chrFiller2, true, 0);
                p_utils.LoadStringToCharArray(this.m_table.Columns[x].DataType.ToString(), ref this.m_printfield.chrFieldType, true, 0);
                p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldNumber, true);
                p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller, false);
                p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldName, false);
                p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller2, false);
                p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldType, false);
                frmTemp.uc_select_list_item1.listBox1.Items.Add(str);
                if (str.Trim().Length > strLargestString.Trim().Length)
                {
                    strLargestString = str;
                }
            }


            frmTemp.uc_select_list_item1.Initialize_Width(strLargestString + "***********");
            frmTemp.uc_select_list_item1.Visible    = true;
            frmTemp.uc_select_list_item1.btnOK.Text = "Print";
            DialogResult result = frmTemp.ShowDialog();

            if (result == DialogResult.OK)
            {
                printing p_oPrint = new printing();
                p_oPrint.PrintListBoxContents("FIA Biosum Data Set Structure", frmTemp.uc_select_list_item1.listBox1);
                p_oPrint = null;
            }


            frmTemp.Close();
            frmTemp = null;
        }