Alarm Clock in C#

Step 1: First of all you simply chose the Windows Form Application and then create a new project. Then design a user interface of this type.

Windows Form Application

Step 2: In this step first we add namespace which is known as Timer, you have two options; you can declare with using clause and second, you can  system namespace in public partial class. We declare in this class and simply make a timer instance then we move to the load event method and i the first line we make an instance and in second line we set a time interval and in third line we make Elapsed Event Handler.

Handler

Step 3:
In this method first we make an instance of DateTime class and then we set now for now time at clock and then in the second line we pick the value from datetimepicker, and in the  third line we make a condition that if user selects the correct time then move to inner section inwhich  we declare the SoundPlayer class, but you must add namespace using System.Media and then we give the sound location path.

  • The three lines of code after try statement --  you can implement it after you read step 5,

    statement

Step 4: In this step we make a code of a button click event, you can simply double click on button and it automatically generates event click method, and one more thing, we add one label in main form and its name as label1.

Program

Step 5: Now we make delegate method to update the value of textbox.

Code