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 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;
        }