Johan__ 0 Newbie Poster

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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.