Link to home
Start Free TrialLog in
Avatar of Mehram
MehramFlag for Pakistan

asked on

VB 6 ASCII Code F1

Sir, In text box I want if user press F1 key the listbox form POP up. And what is  ASCII  code of F1
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mehram

ASKER

I am using following code in textbox=txtbillofladingno but it is not working

Private Sub TxtBillOfLadingNo_KeyPress(KeyAscii As Integer)
If KeyAscii = 112 Then
Form1.Show
End If
End Sub
You have to set the form KeyPreview = True
... and change to KeyDown event where you use the Keycode
Avatar of Mehram

ASKER

I have past code into the KeyDown event however could you guide my how could set kepreview = true?
I thought 112 is the VB code and that decimal 112 equates to the 'p' character?  If wrong I apologise but if you are using Visual studio i.e. not vba then I suspect you need to use the keycode parameter from key up or key down event and check that for equivalence to vbkeyf1.

Chris
Avatar of Mehram

ASKER

no 112 is equivalent to f1 on key code and it is working after changing word keyascii to keycode however i just want to know to to set keypreview true
Select the form on the design mode and on the properties windows select keypreview = true.

But thats only for capture the form events. In the textbox you don't need it.
Avatar of Mehram

ASKER

Thanks Sir