private bool ReadAndValidateName(out string name)
{
name = "";
if (txtName.Text.Length > 0)
{
name = txtName.Text;
return true;
}
else
{
MessageBox.Show("Enter Letters Only", "Invalid Character", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtName.Focus();
return false;
}
}
private bool ReadAndValidatePrice(out double price)
{
price = 0;
double converted;
converted = Convert.ToDouble(txtPrice.Text);
if (converted >= 0.0)
{
price = Double.Parse(txtPrice.Text);
return true;
}
else
{
MessageBox.Show("Enter Numbers Only", "Invalid Character", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtPrice.Focus();
return false;
}
}
private bool ReadAndValidateInput(out string name ,out double price)
{
return ReadAndValidateName(out name) & ReadAndValidatePrice(out price);
}
This is what i get but i need help whit ReadAndValidateInput i need to return if both method is true i need to return troue else return false. I know that is going to be a if and else but what do i need to get in to it to do it?

New Topic/Question
Reply



MultiQuote





|