954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Combining Stopwatch values

I currently have two stopwatches ( running in a VB 2010 program. What I would like to do is combine their values together and have their results outputted in a string formatted as 0:00:00.

I tried the Add method and the + method but this fails.

This is in short what I have:

Dim timer1 As New Stopwatch
Dim timer2 As New Stopwatch

[Assuming the timers were started separately]

Dim elapsed1 As TimeSpan = timer1.Elapsed
Dim elapsed2 As TimeSpan = timer2.Elapsed

elapsed1 += elapsed2

Can anyone help?

thedonedeal
Newbie Poster
18 posts since Dec 2005
Reputation Points: 22
Solved Threads: 0
 

textbox.Text = (timer1.Elapsed + timer2.Elapsed).ToString

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: