Exemple #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();
         }
     }
 }
Exemple #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 = "";
     }
 }