473,441 Members | 1,924 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,441 software developers and data experts.

How To set a a Function Key to click a cmd?

This is what i have

Expand|Select|Wrap|Line Numbers
  1. Public Sub Form_Load()
  2.  KeyPreview = True
  3. End Sub
  4.  
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_KeyDown(KeyCodeConstants As Integer, Shift As Integer)
  2. KeyPreview = True
  3.  If KeyCodeConstants = vbKeyF1 Then cmd1_Click
  4.  If KeyCodeConstants = vbKeyF2 Then cmd2_Click
  5. End Sub
When i press F1 or F2, i get an error msg "Compile error : Sub or Function not defined"

Can anyone please help me? Thank you!

i'm using vb 6.0 enterprise edition
May 15 '09 #1
1 2963
QVeen72
1,445 Expert 1GB
Hi,

In VB6, Form_KeyDown event looks like This :
(KeyCode Instead of KeyCodeConstants )

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  2. If KeyCode = vbKeyF1 Then
  3.     Call cmd1_Click
  4. ElseIf KeyCode = vbKeyF2 Then
  5.     Call cmd2_Click
  6. End If
  7. End Sub
  8.  
Regards
Veena
May 18 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: nick | last post by:
I have the following code: var ocevent = function(v) { alert('javascript event: u clicked '+v); return false; };
2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
3
by: Mark Kurten | last post by:
in the visual studio .NET samples that come with the product, why do javascript functions all have the parameters below. Even though, the event (like Onclick) which is calling it doesn't have any...
24
by: John Gabriel | last post by:
CreateDialogIndirect() fires my Radio button click function without the radio button having being clicked. I am using VC++ 2003.NET. I believe this is yet another Microsoft bug. Have checked dialog...
6
by: rwsims | last post by:
This works in firefox, not at all in ie6. I'm not getting any errors, but only the doalert() function works, not the click() function. I'm sure there's something obvious, but I'm just not seeing...
1
by: finerrecliner | last post by:
what i'm trying to accomplish: user clicks button. then can click 2 more times anywhere on the page and display his mouse coordinates. after those 2 clicks, go back to normal mouse behavior the...
11
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
4
by: simon | last post by:
hi, I would like to separate my javascript completely from my xhtml. in the end there should be only <script type="text/javascript" src="javalib.js"></script> in the head-tag to my javascript....
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.