Description:-
Combination of Key Press In C# win forms is
used to create user friendly applications,
Without clicking buttons and
redirecting to several forms is avoided by providing key combinations.
Form1.cs:
---------
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
keypresss
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void Form1_KeyDown(object
sender, KeyEventArgs e)
{
if
(e.Alt && e.KeyCode==Keys.F5)
|
//Core Concept
{
report
r = new report();
r.Show();
this.Hide();
}
}
}
}
report.cs:
----------
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
keypresss
{
public partial class report : Form
{
public
report()
{
InitializeComponent();
}
private
void button1_Click(object
sender, EventArgs e)
{
Form1
f = new Form1();
f.Show();
this.Show();
}
}
}
Design :Form1
Property
|
Event
|
KeyPreview=false
|
KeyDown
|
Screens:
-------
Fig:Form1
Fig:report
Click below Icon for full project download