ShortCut Keys(F1,F2...F12) Press (Keyboard) Open New Window Form in C# Window Application

Shortcut Key Press Open New Window Form 

Press ShortCut(Function Key) Like (F1,F2...F12) Open New Window Form or Existing Window Forms Using C# Window Application.

                                          DEMO




                                  C# CODING


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

namespace WindowsFormsApplication2
{
    public partial class FunctionKey : Form
    {
        public FunctionKey()
        {
            InitializeComponent();
        }
        private void FunctionKey_Load(object sender, EventArgs e)
        {
            this.KeyUp += new System.Windows.Forms.KeyEventHandler(KeyEvent);
        }
        private void KeyEvent(object sender, KeyEventArgs e) //Keyup Event 
        {
            if (e.KeyCode == Keys.F1)
            {
                Email ee = new Email();
                ee.Show();
            }
            if (e.KeyCode == Keys.F2)
            {
                Logee ll = new Logee();
                ll.Show();
            }
            if (e.KeyCode == Keys.F3)
            {
                Login li = new Login();
                li.Show();
            }
            else if (e.KeyCode == Keys.F4)
            {
                MessageBox.Show("This is Empty");
            }

        }
    }

}


First - Add New Window Form - For Using Function 

Key Event






Next - Add KeyEvent - Function Key(F1,F2,F3.....) Click Assign Form Name





Next - Run[F5] - Function Key Click Open Window 



Forms

0 comments:

Post a Comment