//---------- private bool validateVolumeAndMass(out decimal volume, out int mass) { ValidationClass valid = new ValidationClass(); CorrectValue correct = new CorrectValue(); volume = 0; mass = 0; if (valid.ValidateVolume(VolumeBox.Text)) { volume = decimal.Parse(correct.CorrectVolume(VolumeBox.Text)); } else { MessageBox.Show("Incorrect volume format"); return(false); } if (valid.ValidateMass(MassBox.Text)) { mass = int.Parse(MassBox.Text); } else { MessageBox.Show("Incorrect mass format"); return(false); } return(true); }