From: Family Tree Mike on
On 3/17/2010 7:19 PM, mp wrote:
> ok, even though the help files show the order i first tried,
>> Format(CStr(dHeightOfStone), "#.####")
> i tried the opposite order
>> Format( "#.####", CStr(dHeightOfStone))
> now instead of getting "#.####" returned, i get
> 4.62500000000364
>
> so it's still not formatting
> what am i missing?
>
> as an alternative i tried using round
> Dim sWidthLiner As String =
> CStr(Decimal.Round(Cdec(dLengthOfMoldSidesLiner), 4))
>
> but it seems a long way around to just get a double rounded to x places and
> converted to string
>
> thanks
> mark
>

Mark,

Did you not see Armin's and my responses?

You can use:

1. dHeightOfStone.ToString("#.####")
2. Format(dHeightOfStone, "#.####")
3. dHeightOfStone.ToString("f4")

but none of what you have posted will work. You need a number as the
first argument and a format string as the second. Turn "Option Strict
On" at the top of your code. You should get an error on some of the
things you are trying.

--
Mike
From: mp on
Thanks Mike,
They came in after i posted my second stupid effort
:-)
dumb newbie
:-)
Thanks for the info
I've gone with your favorite dHeightOfStone.ToString("f4")
nice and concise

mark

"Family Tree Mike" <FamilyTreeMike(a)ThisOldHouse.com> wrote in message
news:OL5wxoixKHA.5036(a)TK2MSFTNGP02.phx.gbl...
> On 3/17/2010 7:19 PM, mp wrote:
>> ok, even though the help files show the order i first tried,
>>> Format(CStr(dHeightOfStone), "#.####")
>> i tried the opposite order
>>> Format( "#.####", CStr(dHeightOfStone))
>> now instead of getting "#.####" returned, i get
>> 4.62500000000364
>>
>> so it's still not formatting
>> what am i missing?
>>
>> as an alternative i tried using round
>> Dim sWidthLiner As String =
>> CStr(Decimal.Round(Cdec(dLengthOfMoldSidesLiner), 4))
>>
>> but it seems a long way around to just get a double rounded to x places
>> and
>> converted to string
>>
>> thanks
>> mark
>>
>
> Mark,
>
> Did you not see Armin's and my responses?
>
> You can use:
>
> 1. dHeightOfStone.ToString("#.####")
> 2. Format(dHeightOfStone, "#.####")
> 3. dHeightOfStone.ToString("f4")
>
> but none of what you have posted will work. You need a number as the
> first argument and a format string as the second. Turn "Option Strict On"
> at the top of your code. You should get an error on some of the things
> you are trying.
>
> --
> Mike