hey stuart,any reason you are using a string to represent the time duration? vb.net has in built functions to deal with times, problem with what you are doing is you need to parse the string, what if the user input a time as "Hello world"?
you could for instance use TimeSpan (http://msdn.microsoft.com/en-us/library/system.timespan_properties%28VS.80%29.aspx) then enter a time in one of several formats
This will output to the console the number of seconds in 400m30s, you can then multiply this by the cost per second and divide by 100 to give the value in pounds and pence.Code:Dim days as Integer = 0 Dim hours As Integer = 0 Dim minutes As Integer = 400 Dim seconds As Integer = 30 Dim Duration as New TimeSpan(days, hours, minutes, seconds) Console.WriteLine(Duration.TotalSeconds)




Reply With Quote