473,406 Members | 2,259 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,406 software developers and data experts.

Function Keys

One
hi..
how to get function keys(F1 to F12) when they are
pressed?
Thankx
Nov 20 '05 #1
4 11818
Hi One

Use the following in the KeyDown event handler.

Dim S as String
S = e.KeyCode & ", " & e.KeyValue & ", " & e.KeyData & ", " &
e.Shift

You'll see what happens for the function keys.

Then check out System.Windows.Forms.Keys which is an enumeration
containing constant values for you to use.

Regards,
Fergus
Nov 20 '05 #2
Hello,

"One" <bi******@hotmail.com> schrieb:
how to get function keys(F1 to F12) when they are
pressed?


Set the form's 'KeyPreview' property to 'True', then add this code to your
form (assuming the form's class name is 'Form1'):

\\\
Private Sub Form1_KeyDown( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs _
) Handles MyBase.KeyDown
If e.KeyCode = Keys.F2 Then
MsgBox("F2 pressed!")
End If
End Sub
///

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #3
"One" <bi******@hotmail.com> schrieb
hi..
how to get function keys(F1 to F12) when they are
pressed?
Thankx


Override Sub OnKeyDown or catch the KeyDown event.
--
Armin

Nov 20 '05 #4
One,
In addition to overriding the KeyDown event, if you have a Menu on your form
you can assign the function keys to a MenuItem.

Remember: You can assign the function keys to a MenuItem that has its
Visible property set to false, and it will still work!

See the Shortcut property of a MenuItem, along with the Visible property if
needed.

Then you can simply handle the Click event for the MenuItem.

Hope this helps
Jay

"One" <bi******@hotmail.com> wrote in message
news:01****************************@phx.gbl...
hi..
how to get function keys(F1 to F12) when they are
pressed?
Thankx

Nov 20 '05 #5

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

Similar topics

1
by: Don W. | last post by:
I need to use some function keys as speed-keys (instead of clicking a button with the mouse.) Using this code doesn't display any codes for the function keys: <html><body> <SCRIPT...
4
by: Noah | last post by:
I have a dictionary that I would like to expand to satisfy a function's agument list. I can used the ** syntax to pass a dictionary, but this only works if each key in the dictionary matches an...
1
by: Steve | last post by:
I would like to override the IsInputKey function in order to trap the arrow up/down keys in the Key Events. I understand that arrow keys don't have a char representation and thus, hard to trap. ...
4
by: Broeisi | last post by:
Hello, I'm trying to write a console based program in C in Linux. I want to use the function keys in my program, but I don;t know how to let the C program know when for exmaple the F1 key is...
11
by: Yelena Varshal via AccessMonster.com | last post by:
Hello, I have a problem with one of msaccess.exe API calls that work on my desctop but does not work on the laptop from within MS ACCESS. There is a lot of differences between 2 computers...
5
by: Luke Skywalker | last post by:
Hi to all, I need to suppress the function keys (F1, F2, F3 ecc.) to use these keys to do other operations within the web pages of my application. I wrote this code: ...
1
by: Sam Samson | last post by:
Greeetings All .. For my users convenience I have mapped function keys F2 .. F12 to change the tabs on the Tabcontrol. Works like a charm <ominous musicuntil one hits F8</ominous music> ...
1
by: simiCop | last post by:
I'm writing a computer aided dispatching program targeted at security companies. While within certain text box fields, I want to assign the Function keys (F2, F6, etc.) to trigger a search, exit,...
9
by: Wingot | last post by:
Hey, I am using Visual Studio 2008 Beta 2 for some application development in C#, but I presume that the following question applies equally well to any environment.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.