Simple alarm Clock using Visual Basic.Net
This is tutorial is all about Simple alarm Clock using Visual Basic.Net
In this tutorial, we’re going to create a simple alarm clock. This alarm clock can be used to wake a person at a specific time. To start with this application, open visual basic and create a new project and name it as “Alarm Clock”.
What is Visual Basic’s purpose?
The third-generation programming language was created to aid developers in the creation of Windows applications. It has a programming environment that allows programmers to write code in.exe or executable files. They can also utilize it to create in-house front-end solutions for interacting with huge databases. Because the language allows for continuing changes, you can keep coding and revising your work as needed.
However, there are some limits to the Microsoft Visual Basic download. If you want to make applications that take a long time to process, this software isn’t for you. That implies you won’t be able to use VB to create games or large apps because the system’s graphic interface requires a lot of memory and space. Furthermore, the language is limited to Microsoft and does not support other operating systems.
What are the most important characteristics of Visual Basic?
Microsoft Visual Basic for Applications Download, unlike other programming languages, allows for speedier app creation. It has string processing capabilities and is compatible with C++, MFC, and F#. Multi-targeting and the Windows Presentation Framework are also supported by the system, allowing developers to create a variety of Windows apps, desktop tools, metro-style programs, and hardware drivers.
The application when finished, it looks like as shown below.
Next, add five labels, and name the label1 as “lblcurtime” and label2 as “lblstatus” then,set the text property of the other label as “Current Time”, “Alarm Time” and “Message”. Add a Datetimpicker, then set it into “Time” format. Then add a textbox and a Button, after this rename the textbox1 as “txtmsg” and the button1 as “btnsetalarm”. And lastly add two timer.
This time, we will add functionality to our application.
First, double click the “timer1” and add the following code:
This code will simply check if the current settings of DateTimePicker1 match the Time of the day and the time is based on your local machine. So if match, it performs the following statements.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If TimeOfDay = DateTimePicker1.Text Then 'This will instantiate a new "voice" for this app to speak through Dim voice = CreateObject("SAPI.spvoice") 'what the content of txtmsg will be passed to voice.speak voice.speak(TextBox1.Text) lblstatus.Text = "Status:Alarm is not set!" End If End Sub
Then, double click the “timer2” and add the following code:
This will display the current time based on the local machine.
lblcurtime.Text = TimeOfDay
Next on the “form1_load” add the following code:
Timer2.Enabled = True
And finally, on the “btnsetalarm” button add the following code:
It enables the timer1 and set the alarm clock.
Timer1.Enabled = True lblstatus.Text = "Status:Alarm is set!"
This time you can now try testing your program by pressing “F5”.
Readers might read also:
If you have any questions or suggestions about this Simple Alarm Clock using Visual Basic.net source code, please feel free to leave a comment below.