This is what im going to do. and i was wondering is 0 and max value going in to this or in to InputUtility class? and how do you call GetDouble?
Convert the contents of the price TextBox to a double and
validate the converted value so it is >= 0.0.
Call the GetDouble method from the InputUtility class,
with min value 0 and max value some big number.
Use a const declaration for the max.value
If the validation is true, return true and the out
parameter will have a valid value returning to the
caller.
If the validation is not true, give a friendly message to
the user.
Set the focus to this price textbox.
Return false
private bool ReadAndValidatePrice(out double price)
{
double converted;
converted = Convert.ToDouble(txtPrice.text)
if (converted >= 0.0)
{
price = txtPrice.Text;
return true;
}
else
{
MessageBox.Show("Enter Numbers Only", "Invalid Character", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtPrice.Focus();
return false;