473,473 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form Keypress events trapped twice ????

3 New Member
I discovered that when a Forn Keydown Event Or Form KeyPress event happens
Each character is trapped twice on the same Event routine.
I use VB6, and my form has KeyPreview property = TRUE.
I was debugging a bug concerning use of card Reader, and while entering the
code I found out it works this way.

(When the card is passed correctly with focus on the right field, I get the txtField_keypress and KeyDown events, that are evoked only once each.)

But I have a case in which the txtFields events are not evoked, just the Form Keys events.
How can I avoid it from happening twice? Why does it happen?
Mar 20 '08 #1
3 4209
debasisdas
8,127 Recognized Expert Expert
From your post i am not sure what exactly you are trying to do.
Mar 20 '08 #2
alma27
3 New Member
I am debugging a little problem on a project.
There is a situation that only the form traps the key events (because the user does not put the cursor , where he should, so the control events don't trigger) and I must trap this situation and fix it.
While debugging I found out every time a character is entered (by a card, through a card reader) the Form_KeyPress event is triggered twice, as well as the Form_KeyDown and Form_KeyUp.
I don't understand why?

I guess to test this it is enough to have a Form_keypress routine, and no textbox-keypress routine. So the Form routine will be triggered (if Keypreview=true) Maybe it won't happen to you, but it does to me.
I tried testing the EXE file as well, thinking maybe it is like a bug when running VB not through EXE.
Mar 20 '08 #3
alma27
3 New Member
I created a small project and tested events from Form_keypress
and either if I typed the characters or passed the magnetic card, each character evoked each event ONLY once.

But When I run the large project I work on, every FORM Key event is called twice per each character .
I don't even know where to look for the problem.
Has anybody run into something like this ?????
Mar 20 '08 #4

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

Similar topics

0
by: Tony Pirkle | last post by:
I'm on a team converting a large VB6 enterprise solution into a VB.Net solution. We've started small. In other words, we're taking MS' advice and beginning with small pieces. I've created a...
4
by: Sean Connery | last post by:
I have a Microsoft UI Process Application Block that is controlling child forms in an MDI parent container. The views node in the app.config file has been set to stayOpen=false. Because there...
9
by: don | last post by:
I want to create a transparent form and can write something on it by using Ink. I try to set form.backcolor = color.transparent, but it dosen't accept. And everything will be transprent when i use...
0
by: Steph. | last post by:
Hi, I have made a new custom TextBox control to enable ENTER and TAB keys to be trapped in the "KeyPress" and "KeyDown" Events. to do that I have overridden the "IsInputKey" property in my...
2
by: rege | last post by:
Hi, I have two applications developed in C# say A and B. When user presses key "L" with applicaition A active , it causes a keypress event which causes application B to run. Application A then...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
3
by: tanya | last post by:
I have a page with one form. I have one textbox in the page. I call a client-side function on the OnKeyUp event of the textbox. This function looks at the keycode of the keyup event on the textbox...
3
by: Luc The Perverse | last post by:
Hey - I am making my first C# form application! (More a teach myself app than any pratical application) I have a listbox that always has the control so I made an event handler for KeyDown. I...
4
by: Joergen Bech | last post by:
Just out of curiosity: What is your favorite method of making sure that anything that happens on a form, only happens in response to a single, external event? Take the example below. I have made...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.