for windows Application:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Alt & e.KeyCode.ToString() == "F")
{
Form2 op = new Form2();
op.Show();
}
}
for Web Application:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs"
Inherits="Default7" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
document.attachEvent('onkeyup', KeysShortcut);
function KeysShortcut ()
{
if (event.keyCode == 17)
{
document.getElementById('<%= button1.ClientID %>').click();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="a" runat="server"></asp:ScriptManager>
</div>
<div id="target" style="background-color: gray">This is a simple div</div>
<asp:Button ID="button1" runat="server" onclick="Button1_Click" />
</form>
</body>
</html>
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("About.aspx", false);
}