private string sumExtension() { ValidationBill validate = new ValidationBill(); string sumextension = ""; if (validate.Requiredcbo(txtpos) == false) { sumextension += "\n Pos wrong"; } if (validate.Required(txtinmoney) == false) { sumextension += "\n Pay money not null"; } if (validate.Required(txtinmoney) == true) { if (validate.Compared(float.Parse(txtamount.Text), float.Parse(txtinmoney.Text)) == false) { sumextension = "\n Pay money not lower than total money"; } } if (validate.Requiredcbo(cboaccount) == false) { sumextension += "\n User not null"; } if (validate.RangeDatagridview(lstbilldetail) == false) { sumextension += "\n Bill must have product"; } return(sumextension); }
private void txtinmoney_TextChanged(object sender, EventArgs e) { ValidationBill validate = new ValidationBill(); if (validate.CheckNumTextbox(txtinmoney) == true) { if (validate.RangeDatagridview(lstbilldetail) == true) { try { float outp = float.Parse(txtinmoney.Text) - float.Parse(txtamount.Text); if (outp < 0) { txtoutmoney.Text = "0"; } else { txtoutmoney.Text = outp.ToString(); } } catch { txtoutmoney.Text = "0"; } } else { txtoutmoney.Text = txtinmoney.Text; } } else { if (txtinmoney.Text == "" && txtamount.Text == "0") { } else { MessageBox.Show("Must input number in this field"); } } }