Q

Need Timer control to enable after clicking check button

I'm using the Timer control and need it to be enabled after I click the check button. Then I need it to erase the data in two of my labels to allow for entry of more data.
Public Class Form1
    Inherits System.Windows.Forms.Form

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            Label1.Text = "Timer Enabled"
            Label2.Text = "Timer Enabled"
            Timer1.Enabled = True
        Else
            Label1.Text = "Disabled Timer"
            Label2.Text = "Disabled Timer"
            Timer1.Enabled = False
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
        Label2.Text = Date.Now()
    End Sub
End Class

This was first published in March 2004

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close