Lap Timer using Visual Basic.Net

In today’s lesson, we are going to create a Lap timer using visual basic. To start with, we need the “Split Timer Using Visual Basic.Net”. Download it and continue with our tutorial below. Let’s begin our tutorial. First change the property name of “Split” button into “btnLap” from “btnsplit”, then we'll change also the Text property of this button into “Lap” from “Split”. Then as expected it looks like as shown below. Then let’s add the code to the “Lap” button, and here’s the code.
  1.    
  2.         Dim mesage As String
  3.         mesage = "Click start first before you click Lap timer."
  4.  
  5.         'it check if the timer is running then
  6.         If Timer1.Enabled = True Then
  7.             'it will refresh the datagridview
  8.             DataGridView1.Refresh()
  9.             'get the data from the textbox and pass it into datagridview as a record of lap time
  10.             DT.Rows.Add(txttime.Text)
  11.             'it calls the btnrestart button to execute so that it will reset the timer
  12.             btnrestart_Click(sender, e)
  13.         Else
  14.             'this message will show if the timer is not not running that you click the lap button
  15.             MessageBox.Show(mesage, "Stopwatch", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)
  16.         End If
And you can test our program now if it is really running. Thanks for reading folks.

Add new comment