Saturday 17 May 2014

Make application to beep and How to add a delay in second


                                                                                                                                     Previous..
                                                                                                                                       Next....

Here i will explain How to Make application to beep  and How to add a delay in second.

Step(1):Form
Drag and down a button from toolbox.


Step(2):Code
Double click on button a write this code.
Add a NameSpace
"Using System.Threading;"
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
Using System.Diagnostics;
Using System.Threading;
using System.Text;
using System.IO;

namespace First_Csharp_app
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
private void Choose_Btn_click(object sender, EventArgs e)
{
For(  int i = 0 ; i <= 5 ; i ++)
{
Console.Beep();
Thread. Sleep( 1000 );

}

}
Step(3):Output
Run your application and click on button then you will listen a beep.
                                                                                                                                     Previous..
                                                                                                                                       Next....

No comments:

Post a Comment

C# program Selection Sorting

Selection sort is a straightforward sorting algorithm. This algorithm search for the smallest number in the elements array and then swap i...