Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / June 2005

Tip: Looking for answers? Try searching our database.

Calculating Time in VB .Net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian - 30 Jun 2005 04:09 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, 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.