CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: ToDouble() ??

  1. #1
    Join Date
    Nov 2004
    Posts
    5

    ToDouble() ??

    Hi @ll.
    thisone is quite simple, but it seems not to be my day, so im asking you:

    Code:
    String *S = "1234.3245";
    double d = S->ToDouble();
    an IFormatProvider is needed as param for ToDouble, but i didnt manage to figure out, how to

    regards.

  2. #2
    Join Date
    Nov 2003
    Location
    Seattle, WA
    Posts
    265

    Re: ToDouble() ??

    Try this.

    Code:
    String *s = "1234.3245";
    double d = Double::Parse( s );
    "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!!!"

  3. #3
    Join Date
    Aug 2004
    Posts
    53

    Re: ToDouble() ??

    Usually when I convert strings to doubles in VC++ .NET, I use something like this:

    String *str = S"1234.5678";
    double d = System::String::Convert::ToDouble(str);

    If you include "using namespace System::String;" at the top of your form, you can change the second line to just :

    double d = Convert::ToDouble(str);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured