From: Keith on
Hello,
I have the following sequence of statements


double MyDouble1;
bool TryParseReturnValue;
String ^ a = gcnew String("123.456");
TryParseReturnValue = Double::TryParse(a,MyDouble1);
MyDouble1 += 1;
a = Double::ToString(MyDouble1,IFormatProvider); // <---- error here


I do not understand what I need to put into the line with the error in order
to make it work. It's clear that "IFormatProvider" is incorrect, but what
are the exact options. Can you help?

Keith

From: Faisal on
On Apr 21, 7:12 am, Keith <Ke...(a)discussions.microsoft.com> wrote:
> Hello,
> I have the following sequence of statements
>
> double MyDouble1;
> bool TryParseReturnValue;
> String ^ a = gcnew String("123.456");    
> TryParseReturnValue = Double::TryParse(a,MyDouble1);
> MyDouble1 += 1;
> a = Double::ToString(MyDouble1,IFormatProvider);  // <---- error here
>
> I do not understand what I need to put into the line with the error in order
> to make it work.  It's clear that "IFormatProvider"  is incorrect, but what
> are the exact options.  Can you help?
>
> Keith  

ToString is not a static member in the Double class. You have to call
MyDouble.ToString(..)
Also you have to specify the format string and culture-specific
formatting info.

see the documentation
http://msdn.microsoft.com/en-us/library/d8ztz0sa.aspx

For eg,

using System::Globalization;

double dbl = 25.693;

String^ specifier = gcnew String(L"G");
String^ str = dbl.ToString( specifier,
CultureInfo::InvariantCulture );


From: Keith on
Hi Faisal,

Thank you very much for your help. I will follow your steps. I see how
this works, now.

Thank you,

Keith



"Faisal" wrote:

> On Apr 21, 7:12 am, Keith <Ke...(a)discussions.microsoft.com> wrote:
> > Hello,
> > I have the following sequence of statements
> >
> > double MyDouble1;
> > bool TryParseReturnValue;
> > String ^ a = gcnew String("123.456");
> > TryParseReturnValue = Double::TryParse(a,MyDouble1);
> > MyDouble1 += 1;
> > a = Double::ToString(MyDouble1,IFormatProvider); // <---- error here
> >
> > I do not understand what I need to put into the line with the error in order
> > to make it work. It's clear that "IFormatProvider" is incorrect, but what
> > are the exact options. Can you help?
> >
> > Keith
>
> ToString is not a static member in the Double class. You have to call
> MyDouble.ToString(..)
> Also you have to specify the format string and culture-specific
> formatting info.
>
> see the documentation
> http://msdn.microsoft.com/en-us/library/d8ztz0sa.aspx
>
> For eg,
>
> using System::Globalization;
>
> double dbl = 25.693;
>
> String^ specifier = gcnew String(L"G");
> String^ str = dbl.ToString( specifier,
> CultureInfo::InvariantCulture );
>
>
> .
>
From: Keith on
Hi Faisal,
Thanks very much. I tried this out, and the program now works
I appreciate your help.
Keith