private void btnAdd_Click(object sender, EventArgs e)
 {
     if (selectPanleType == 0)
     {
         //IP地址添加
         Frm_Ip_Config_new frm = new Frm_Ip_Config_new(this, 0);
         frm.ShowDialog(this);
     }
     else
     {
         //关联配置
         Frm_Station_Add_new frmS = new Frm_Station_Add_new(this, 0);
         frmS.ShowDialog(this);
     }
 }
        private void btnLaws_Click(object sender, EventArgs e)
        {
            DataGridViewRow r = null;
            int             i = 0;

            switch (selectPanleType)
            {
            case 0:    //配置TCP信息
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value != null)
                    {
                        if (row.Cells[0].Value.Equals("True"))
                        {
                            i++;
                            if (i > 1)
                            {
                                break;
                            }
                            r = row;
                        }
                    }
                }
                if (i == 0)
                {
                    MessageBox.Show("请选择要修改的TCP关联配置信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                else if (i > 1)
                {
                    MessageBox.Show("所选TCP关联配置信息不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                if (r != null)
                {
                    Frm_Ip_Config_new Frm = new Frm_Ip_Config_new(this, 1);
                    Frm.DgvRow = r;
                    Frm.ShowDialog(this);
                }
                break;

            case 1:    //关联TCP和分站信息
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value != null)
                    {
                        if (row.Cells[0].Value.Equals("True"))
                        {
                            i++;
                            if (i > 1)
                            {
                                break;
                            }
                            r = row;
                        }
                    }
                }
                if (i == 0)
                {
                    MessageBox.Show("请选择要修改的TCP关联配置信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                else if (i > 1)
                {
                    MessageBox.Show("所选TCP关联配置信息不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                if (r != null)
                {
                    Frm_Station_Add_new FrmStationAdd = new Frm_Station_Add_new(this, 1);
                    FrmStationAdd.DgvRow = r;
                    FrmStationAdd.ShowDialog();
                }
                break;

            default:
                break;
            }
        }
 private void btnLaws_Click(object sender, EventArgs e)
 {
     DataGridViewRow r = null;
     int i = 0;
     switch (selectPanleType)
     {
         case 0://配置TCP信息
             foreach (DataGridViewRow row in dataGridView1.Rows)
             {
                 if (row.Cells[0].Value != null)
                 {
                     if (row.Cells[0].Value.Equals("True"))
                     {
                         i++;
                         if (i > 1)
                         {
                             break;
                         }
                         r = row;
                     }
                 }
             }
             if (i == 0)
             {
                 MessageBox.Show("请选择要修改的TCP关联配置信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             else if (i > 1)
             {
                 MessageBox.Show("所选TCP关联配置信息不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             if (r != null)
             {
                 Frm_Ip_Config_new Frm = new Frm_Ip_Config_new(this, 1);
                 Frm.DgvRow = r;
                 Frm.ShowDialog(this);
             }
             break;
         case 1://关联TCP和分站信息
             foreach (DataGridViewRow row in dataGridView1.Rows)
             {
                 if (row.Cells[0].Value != null)
                 {
                     if (row.Cells[0].Value.Equals("True"))
                     {
                         i++;
                         if (i > 1)
                         {
                             break;
                         }
                         r = row;
                     }
                 }
             }
             if (i == 0)
             {
                 MessageBox.Show("请选择要修改的TCP关联配置信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             else if (i > 1)
             {
                 MessageBox.Show("所选TCP关联配置信息不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             if (r != null)
             {
                 Frm_Station_Add_new FrmStationAdd = new Frm_Station_Add_new(this, 1);
                 FrmStationAdd.DgvRow = r;
                 FrmStationAdd.ShowDialog();
             }
             break;
         default:
             break;
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (selectPanleType==0)
            {
                //IP地址添加
                Frm_Ip_Config_new frm = new Frm_Ip_Config_new(this, 0);
                frm.ShowDialog(this);
            }
            else
            {
                //关联配置
                Frm_Station_Add_new frmS = new Frm_Station_Add_new(this, 0);
                frmS.ShowDialog(this);
            }

        }