Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

More Novice Questions

$
0
0
Im trying to write a program that displays the time between start and stop of a stopwatch. I don't obiously know what I'm doing because I don't understand the syntax use in an example from the MicroSoft library.

Here's what I have:

Public Class Form1
Dim stopwatch As New Stopwatch

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
stopwatch.Start()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
stopwatch.Stop()
Dim ts As TimeSpan = stopwatch.Elapsed
elapsedTime = stopwatch.Elapsed
TextBox1.Text = elapsedTime as integer

I'm tryiing to load the elapsed time into a textbox. I don't know what "ts" means unless it's some kind of variable. I get elapsedTime a not declared. Tried an number of other things and get that elapsedTime cannot be declared an integer or string. Any help would be much appreciated. Thanks.

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>