Mark,
In addition to the other comments.
Rather then try to format hour, minute, second variables as independent
variables I find it easier to use DataTime & TimeSpan variables. As they
provide built-in formatting as well as reduce the number of variables I am
using.
Something like:
Dim hours As Integer = 0
Dim minutes As Integer = 0
Dim seconds As Integer = 1
Dim theTime As New TimeSpan(hours, minutes, seconds)
Dim s As String
s = theTime.ToString()
Note TimeSpan itself only supports a fixed format, I will convert a TimeSpan
into a DateTime if I need custom formatting.
s = String.Format("{0:H:mm:ss}", DateTime.MinValue.Add(theTime))
For details on custom datetime formats see:
http://msdn.microsoft.com/library/de...matstrings.asp
For information on formatting in .NET in general see:
http://msdn.microsoft.com/library/de...ttingtypes.asp
Hope this helps
Jay
"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:57**********************************@microsof t.com...
I am running into a weird problem. I am using the following code:
String.Format("{0:0}:{1:00}:{2:00}", Hours.ToString, Minutes.ToString,
Seconds.ToString)
Just say seconds is set to 1, it should return a string that displays
0:00:01, but it isn't display that, instead I get 0:0:1. Can anyone tell
me
why the format function isn't displaying both digit placeholders? 00 as a
format should return 01, not 1. Any ideas?