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 last 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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close