Social Icons

Friday, 14 March 2014

Key press


If you press any key from your keyboard and system tell you that yes you press this or that key then many person surprised that yes its a good job.
but i tell you its a very simple and only 4 line code you have to only know about the ASCII values of each key.
example-
key                                          ASCII
0-9                                           48-57
a-z                                            97-122
A-Z                                          65-90

and many other are there.

So check this interface and then see how its work..                                        Download

download from here 




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace keypress
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
           
            if (e.KeyChar >= 00 && e.KeyChar <= 126)
                MessageBox.Show("You Pressed : " + e.KeyChar);
        }
       
    }
}

 click here for download

No comments:

Post a Comment