How to parse decimal number input from form ?

  • Thread starter Thread starter News charter
  • Start date Start date
N

News charter

I have a form that I need to pass the sales tax. Works great if sales tax is
an interger.

When I try to parse the sales tax with decimal place with Int32.Parse method
I get exception.

The sale tax field is input 7.5
when I pass this field to Int32.Parse(salesTax.Text)

What is the available method on the libarary I can use to do this ?

Where can I find references to all commonly used methods.
I guess they are part of the .NET class library.
Is there a quick references that list all of the widely used ones.

Does anyone know of a book out there that lists what's available on the
..NET class library ? Do we learn to use them as we gain experience ?

thanks
 
The sale tax field is input 7.5
when I pass this field to Int32.Parse(salesTax.Text)

why do not you use double.Parse or Decimal.Parse to parse floating point
numers?

Regards, Wiktor
 
If you want to avoid an exception (which take too much time in my
development environment), you might use double.TryParse() instead. One of
its overloads returns the result.
Tom Clement
Apptero, Inc.
 
Back
Top