p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Beginning VB 6 (http://p2p.wrox.com/forumdisplay.php?f=75)
-   -   KeyPress Event in VB different from VBA (http://p2p.wrox.com/showthread.php?t=8898)

PaulG February 3rd, 2004 12:33 PM

KeyPress Event in VB different from VBA
I am porting my VBA Outlook code to VB6 and run into problems with the KeyPress Event; this does not work in VB6 for me:

Private Sub Text1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    MsgBox "test"
End Sub

I get this message:
Procedure declaration does not match description of event or procedure having same name

What am I doing wrong?


gbianchi February 3rd, 2004 12:37 PM

hi there..

that's not the declaration for the keypress event in Vb6..

try commenting the code.. and look at the combo for the correct declaration for the event...


Gonzalo Bianchi

PaulG February 3rd, 2004 01:14 PM

Hi Gonzalo,

I am afraid I do not understand what you try to say.
If I go to the code of the form and pull down the keypress event, this is what I get, and it is not far off from what I initially used. The problem however is that this is not using Returninteger or anything that demands user input.

Private Sub Form_KeyPress(KeyAscii As Integer)
End Sub


gbianchi February 3rd, 2004 01:31 PM

hi there..

anyway.. the last one is the way that should be declare.. even if you dont use returninteger...

and is really diferent..

they are two different types of variables.. i don't know how returninteger works.. you should use the one from the combo box...

Gonzalo Bianchi

All times are GMT -4. The time now is 04:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.