예제 #1
0
 private void CashRecTxt_Validating(object sender, CancelEventArgs e)
 {
     if (CashRecTxt.Text != "" && grossLabel.Text != "")
     {
         if (!(Convert.ToSingle(grossLabel.Text) <= Convert.ToSingle(CashRecTxt.Text)))
         {
             CashRecTxt.Text = "";
             CashBTXT.Text   = "";
             CashRecTxt.Focus();
         }
     }
 }
예제 #2
0
 private void CashRecTxt_TextChanged(object sender, EventArgs e)
 {
     if (CashRecTxt.Text != "")
     {
         if (!rg.Match(CashRecTxt.Text).Success)
         {
             CashRecTxt.Text = "";
             CashRecTxt.Focus();
         }
         else
         {
             float amountGiven  = Convert.ToSingle(CashRecTxt.Text);
             float amountReturn = amountGiven - Convert.ToSingle(grossLabel.Text);
             CashBTXT.Text = Math.Round(amountReturn, 0).ToString();
         }
     }
     else
     {
         CashBTXT.Text = "";
     }
 }