For some reason I cannot get VB to register when the Tab key is pressed. Any idea why?
------------------
Ryan
Printable View
For some reason I cannot get VB to register when the Tab key is pressed. Any idea why?
------------------
Ryan
It should. Are you checking for vbKeyTab (=9)?
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
yes, I am, but see the thing is, it's not even going into the KeyDown event code. So it's not even getting to the
If KeyCode = vbKeyTab Then
statement. And I can't figure out why.
------------------
Ryan
[This message has been edited by Gimpster (edited 02-10-2000).]
That should work. Are you sure you put this code in KeyDown / KeyUp and not KeyPress?
------------------
[email protected]
...
Every program can be reduced to one instruction which doesn't work.
yes, I'm sure. I mean it's very baffling, because I have a break point set at the very first line of the KeyDown event and VB doesn't even go into the event code. It never even looks there. It just goes on and inserts the tab and that's it. It doesn't check any code whatsoever. I don't understand it.
------------------
Ryan
Do you have code in the LostFocus event? If so that will fire first.
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
Yes, I do. The code I have in the LostFocus event re-enables all the tabstops on the other objects. That's the only thing it does, but would that cause problems?
------------------
Ryan
Apparently it does. I created a small app with two textboxes and 1 command button. I set Text2.TabStop = False and in Text1.LostFocus I set Text2.TabStop = True. I also set a breakpoint in Text1.KeyDown. When I ran the program and tabbed out of Text1, the KeyDown event never happened.
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
I would say that the problem is deeper!
TAB is (i think) sending a system message to change the focus to the next control, and thiat is happening even befor the form is envoking any events (including controls events)
Hey!! Whats going on...
You may want to try setting the KeyPreview property of you FORM to true, and put the check for the TAB key in the KEY DOWN event of the form.
I had a similar problem trying to get DELETE and BACKSPACE to work together. this did the trick!
Hope it helps!
~Sam
Gimpster ;
Vb is slow at getting keydowns events ,
when u press tab over a form or any control
give it some time ... press it for a while
2 to 5 seconds ... i had the same problem when holding a shift key over a button ,
i have to hold the shift key over the button for a while for vb to notice this ...
try it , i think it will work ...
------------------
- regards -
- razzaj -
Ok, thank you for all the suggestions. And, Rassaj, do you know if there is any way to make VB recognize the keydown quicker?
------------------
Ryan