I'm learning to program with VB .Net. I'm trying to write a program that
will calculate jogging time. I have Text boxes for Distance1, Distance2,
Speed1, Speed2, Time1, Time2, and Total Time. For example, say I run 2 miles
at 8mph (7:30 minute miles) and 1 mile at 7.5mph (8 minute miles). I enter 2
in Distance1, 1 in Distance2, 8 in Speed1, and 7.5 in Speed2. I can
calculate in decimal (10.25, 10.5, 10.75 minutes, etc.) How would I
calculate the three times in minutes and seconds (10:15. 10:30, 10:45)?
Thanks!
Cor Ligthert - 30 Jun 2005 07:26 GMT
Brian,
This sounds like a student question.
Basicly you calculate it in the same way as on a piece of paper, however you
use than some code to do that, which differs not much from that.
Cor
Armin Zingler - 30 Jun 2005 09:55 GMT
> I'm learning to program with VB .Net. I'm trying to write a program
> that will calculate jogging time. I have Text boxes for Distance1,
[quoted text clipped - 4 lines]
> 10.5, 10.75 minutes, etc.) How would I calculate the three times in
> minutes and seconds (10:15. 10:30, 10:45)? Thanks!
Have a look at the very helpful DateTime (called Date in VB.Net but they are
identic) and TimeSpan types and there members.
Armin
Brian - 30 Jun 2005 16:26 GMT
"Cor Ligthert" wrote:
> Brian,
>
[quoted text clipped - 4 lines]
>
> Cor
No, not a student. Thanks for asking though. Just a database analyst who
likes to run and trying to add some programming by starting off with
something really basic. Have to start small you know.
> > I'm learning to program with VB .Net. I'm trying to write a program
> > that will calculate jogging time. I have Text boxes for Distance1,
[quoted text clipped - 9 lines]
>
> Armin
Thanks Armin! Will do.
Cor Ligthert - 30 Jun 2005 18:08 GMT
Brian,
Than in addition to Armin is TimeSpan what you need and than the method
"FromSeconds" or an equivalent. I write that because I have seen that these
ones are easily missed.
I hope this helps,
Cor
Cor Ligthert - 30 Jun 2005 18:26 GMT
I thought that I gave the link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemtimespanclassfromsecondstopic.asp
Cor