|
-
January 26th, 2004, 12:18 AM
#1
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!
-
February 16th, 2004, 09:06 PM
#2
Code:
Double a = Double::Parse(A_coeff->Text);
Double b = Double::Parse(B_coeff->Text);
Double c = Double::Parse(C_coeff->Text);
I'm new to C++ .NET so I don't know if this is right but it converts properly..
"Lose it? It means go crazy...nuts...insane...bonzo...no longer in possession of one's faculties...3 fries short of a happy meal...WACKO!!!"
-
December 11th, 2009, 05:13 PM
#3
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.
-
December 18th, 2009, 04:21 AM
#4
Re: Text-Box to Double conversion
Parse is throwing an exception if the function fails. TryParse is not throwing.
-
December 27th, 2009, 01:24 AM
#5
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|