Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Keyascii


Reply
 
Thread Tools Display Modes
  #1  
Old 03-27-2004, 10:37 PM
kwA kwA is offline
Freshman
 
Join Date: Nov 2003
Posts: 45
Default Keyascii


Where can I find different keyascii values for the F keys?
Or how can I do this:
Either using ascii or another replacement for an F key?

Code:
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = bah Then Call bloop End If End Sub
Reply With Quote
  #2  
Old 03-27-2004, 10:46 PM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

By "F Keys" do you mean the Function keys? If so you cannot detect those in the KeyPress event. You can use the following code to demonstrate this to yourself:

Code:
Private Sub Text1_KeyPress(KeyAscii As Integer) MsgBox KeyAscii End Sub

You CAN capture the Function keys, navigation keys, etc. using the KeyDown and KeyUp events.

VB comes with a set of predefined constants for the function keys - vbKeyF1 can be used to detect this key:

Code:
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then MsgBox "The F1 key was pressed" End If End Sub

EDIT: I forgot to add - you can get the various keycode constants from the Object Browser in the VB IDE. Right-mouse in the code window and select KeyCode Constants in the Class pane.
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
Reply With Quote
  #3  
Old 03-27-2004, 10:54 PM
kwA kwA is offline
Freshman
 
Join Date: Nov 2003
Posts: 45
Default

tyvm
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form KeyPress Event EpcH General 8 12-28-2003 11:07 PM
Need help with Keyascii in a textbox fancy text mainenwo General 2 10-09-2003 10:29 AM
Exact controlling of input into a text-box Hertell General 3 10-17-2002 09:30 PM
need help in form arctick General 12 01-23-2002 11:35 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->