예제 #1
0
 private void txtDGVItem_Leave(object sender, EventArgs e)
 {
     try
     {
         lock (this)
         {
             if (blnUnloadFormflag == false) //Unload时不再执行,否则报错!
             {
                 if (PNInfo.checkTypeOK(txtDGVItem.Text.ToString(), lblMyType.Text.ToString()))
                 {
                     string tempStr = "";
                     if (dgvEquipPrmtr.Columns.Contains("ItemValue"))
                     {
                         if (mylastDGVRowIndex != -1)    //140714_1
                         {
                             tempStr = dgvEquipPrmtr.Rows[mylastDGVRowIndex].Cells["ItemValue"].Value.ToString();
                             dgvEquipPrmtr.Rows[mylastDGVRowIndex].Cells["ItemValue"].Value = txtDGVItem.Text.ToString().Trim();
                         }
                     }
                     else if (dgvEquipPrmtr.Columns.Contains("内容"))
                     {
                         if (mylastDGVRowIndex != -1)    //140714_1
                         {
                             tempStr = dgvEquipPrmtr.Rows[mylastDGVRowIndex].Cells["内容"].Value.ToString();
                             dgvEquipPrmtr.Rows[mylastDGVRowIndex].Cells["内容"].Value = txtDGVItem.Text.ToString().Trim();
                         }
                     }
                     txtDGVItem.Visible = false;
                 }
                 else
                 {
                     txtDGVItem.Focus();
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #2
0
 private void cboValue_Leave(object sender, EventArgs e)
 {
     try
     {
         if (cboDirection.Text.ToString().ToUpper().Trim() == "INPUT".ToUpper()
             &&
             (cboItemType.Text.ToString().ToUpper() == "UInt16".ToUpper() ||
              cboItemType.Text.ToString().ToUpper() == "double".ToUpper() ||
              cboItemType.Text.ToString().ToUpper() == "byte".ToUpper()
             ))
         {
             if (PNInfo.checkTypeOK(cboValue.Text.ToString(), this.cboItemType.Text.ToString()) == false)
             {
                 cboValue.Focus();
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }