You think? I don't code programs on the basis of what I think the functions do. If you follow the link I posted or the documentation Armin suggested, you won't need to make suppositions about how the formatting works.
Regards.
"cj" <
[email protected]> escribió en el mensaje | Actually that'd be ok but I don't think that'd be rounding. I'd think
| that would be truncating.
|
|
| José Manuel Agüero wrote:
| > Hello cj,
| >
| > I suppose Armin was suggesting something like this:
| > label1.text = finishtime.Subtract(starttime).TotalSeconds.ToString("0.####")
| >
| > Custom Numeric Format Strings
| >
http://msdn2.microsoft.com/en-us/library/0c899ak8(VS.80).aspx
| >
| > Regards.
| >
| >
| > "cj" <
[email protected]> escribió en el mensaje | > |I didn't find rounding any functionality in tostring. I did however
| > | solve the problem with:
| > |
| > | label1.text = Math.Round(finishtime.Subtract(starttime).TotalSeconds,
| > | 4).ToString
| > |
| > | I'd hoped there was a method I could use instead of using the math.round
| > | function but I guess not.
| > |
| > | Armin Zingler wrote:
| > | >> I'm using
| > | >>
| > | >> label1.text = finishtime.Subtract(starttime).TotalSeconds.ToString()
| > | >>
| > | >> courtesy of Marina to display how long a piece of code has taken. It's
| > | >> been less than a second so far but might go over. The only
| > | >> down side is I'd like this rounded to a max of say 4 decimal places.
| > | >> It gives me long numbers. How can I do this?
| > | >
| > | > Look at the documentation for the ToString method. It's overloaded.
| > | >
| > | >
| > | > Armin