Text-Box to Double conversion
I've three textboxes I want to convert to Double.
I don't know to use the IFormatProvider interface ...
Code:
// obtener los nĂºmeros desde el textbox
IFormatProvider* ifp;
Double a = A_coeff->Text->ToDouble(ifp);
Double b = B_coeff->Text->ToDouble(ifp);
Double c = C_coeff->Text->ToDouble(ifp);
The problem is in ToDouble(ifp).. that's causing an exception.
A_coeff, B_coeff and C_coeff are the textboxes.
Thanks!
Re: Text-Box to Double conversion
Jinto, it seems that a newcomer is sometimes what is necessary to get a straight answer. Of course, if you are still visiting this site, you are not so new to .net now! Thanks.
Re: Text-Box to Double conversion
Parse is throwing an exception if the function fails. TryParse is not throwing.
Re: Text-Box to Double conversion
Hi ,
If Parse is throwing an exception, then the problem is with the conversion,
As for TryParse, it shall never throw an exception, as it returns a boolean value on succesful conversion.
I suggest you use TryParse .
Sujay