Today, I will teach you how to create and display the digital and analog time.
Now, let's start
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add two radioButtons named rbDigital and rbanalog. Insert also a timer named Timer1, add a label named Label2, and a webbrowser named WebBrowser1. You must design your interface like this:
the URL property of your webbrowser so that we can have the analog clock. -http://www.gheos.net/js/clock/clock.swf
For the coding:
To get the digital time, we will code for the ticking of our Timer:
Label2.Text = TimeOfDay
To display the digital clock when pressing the rbDigital radiobutton, have the code below:
- If rbDigital.Checked = True Then
Timer1.Start()
Label2.Show()
WebBrowser1.Hide()
Else
Label2.Hide()
WebBrowser1.Show()
End If
To display the analog clock when pressing the rbAnalog radiobutton, have the code below:
- If rbanalog.Checked = True Then
WebBrowser1.Show()
Label2.Hide()
Else
WebBrowser1.Hide()
Label2.Show()
End If
By default, we will have put rbDidital to be checked in loading the Form. Have this code:
rbDigital.Checked = True
0 comments:
Post a Comment