473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

run exe from button

i was wondering if there is someone that can tell me how i can use the
numbers from 0-9 on the right side of the keyboard to run any exe file.

thx in advance for the help
Jan 11 '06 #1
4 3871
You may need to set the form's PreviewKey to true and hook its KeyDown
event. Check for Keys.Numpad0 - Keys.Numpad9. If you want to determine
the state of the Numlock key, call the API GetKeyState or
GetKeyboardState,

Thi

Jan 11 '06 #2
can you be a bit more specific plz
"Truong Hong Thi" wrote:
You may need to set the form's PreviewKey to true and hook its KeyDown
event. Check for Keys.Numpad0 - Keys.Numpad9. If you want to determine
the state of the Numlock key, call the API GetKeyState or
GetKeyboardState,

Thi

Jan 11 '06 #3
Click the form then click events and keydown. The source should
explain it:
Curtis
http://www.ghostclip.com
Premier Popup Notepad & Help System For Developers

private void Form1_KeyDown(object sender, KeyEventArgs e)
{

if (e.KeyData == Keys.NumPad0)
{
System.Diagnostics.Process.Start("firefox.exe");
}
else if (e.KeyData == Keys.NumPad1)
{
System.Diagnostics.Process.Start("iexplore.exe");
}

}

Jan 11 '06 #4
The first thing is determine which keypad lauch which application. I
assume you read it from a config file and store in a hashtable:
I assume you choose System.Windows.Form.Keys enum to be keys and
strings to be value.
On the form, set PreviewKey to true.
In the form KeyDown event:
if (e.KeyData >= Keys.NumPad0 && e.KeyData <= Keys.NumPad9)
{
if (table[e.KeyData] != null)
{
Process.Start((string) table[e.KeyData]);
}
}

This only works it numlock is on.

Jan 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt | last post by:
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form...
6
by: Skip Hollowell | last post by:
I am working on a menu bar for a site, and am using buttons in the bar (because the customer wants to use accessKeys for each selection, apparently it is too much work to click on them with a...
5
by: TrvlOrm | last post by:
Can any one please help me...I am new to JavaScript and I have been struggling with this code for days now and can't figure it out. I would like to get the Buttons to correspond with the action...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
25
by: KK | last post by:
Hi, I am using history.go(-1) for implementing the back button functionality. Its working fine but with this exception. 1. The page which is having back button has some hyperlinks on it. ...
3
by: Zürcher See | last post by:
Someone has implemented a Datagrid Button for the Windows.Form?
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
7
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
23
by: shashi shekhar singh | last post by:
Dear sir, I have a word document file contains text and images, now i have saved it as a web page and wants to display it on browser , using , string str=directory.getfiles("");...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.