|
-
Oct 7th, 2008, 10:45 AM
#1
Thread Starter
Addicted Member
[RESOLVED] KeyDown event fires twice.
Hi,
I'm updating a project (V8xx to V9), the project uses a textbox to accept data from the keyboard. Nothing has changed in any of the events for this textbox.
The KeyDown event uses both vbKeyBack and vbKeyEscape KeyCodeConstants. With the new version, with no changes in any of the events for this textbox, pressing either key cause the action to be performed twice!
Anyone have a clue?
-
Oct 7th, 2008, 11:06 AM
#2
Re: KeyDown event fires twice.
 Originally Posted by Gymbo
I'm updating a project (V8xx to V9)
That is VB.NET
Moved
-
Oct 7th, 2008, 11:17 AM
#3
Thread Starter
Addicted Member
Re: KeyDown event fires twice.
Sorry Hack,
My VB6 project is going from Version 8.0.4 to Version 9.0.0. I had no idea there was a difference between the version information in VB6 and VB.Net, can you move it back?
Gymbo
-
Oct 7th, 2008, 06:54 PM
#4
Thread Starter
Addicted Member
Re: KeyDown event fires twice.
More information.
Pressing the Backspace key once, removes two characters, from the text box, it should only remove one.
Pressing the Esc key removes the entire line of text, which is correct, then Windows plays the "Windows XP Ding.wav" which is the Default Beep on my system. If I press the Esc key twice or more in the previous version Windows does not respond with a sound.
Gymbo
-
Oct 8th, 2008, 10:20 AM
#5
Re: KeyDown event fires twice.
Posting the faulty code would help us determine what is wrong...
-
Oct 8th, 2008, 10:56 AM
#6
Thread Starter
Addicted Member
Re: KeyDown event fires twice.
That's the crux of the problem, if I knew the faulty code I'd certainly post it, modify it, or remove it.
The KeyDown event uses both vbKeyBack and vbKeyEscape KeyCodeConstants. With the new version, with no changes in any of the events for this textbox, pressing either key causes the action to be performed twice!
I'm planning on changing V9 back to V8.0.4 one procedure at a time until I find the culprit, I'll report here when/if I do.
-
Oct 8th, 2008, 11:01 AM
#7
Re: KeyDown event fires twice.
Perhaps you could post the code in your KeyDown event? Or do you also have codes in your KeyPress and KeyUp events?
-
Oct 8th, 2008, 11:58 AM
#8
Thread Starter
Addicted Member
Re: KeyDown event fires twice.
dee-u,
I've tracked it down, it turns out I did add a couple of lines of code to the KeyPress event for that text box, that wasn't need and caused the problems,
Code:
' Case Is < 58, Is > 47 'number key pressed
' FlagKey = True
Case Is < 48, Is > 57 'must be between 0 & 9
KeyAscii = 0
End Select
If KeyAscii Then keypressed = True
The commented code is what was added and the FlagKey is set elsewhere.
I still don't know why it caused the problems.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|