Google Answers Logo
View Question
 
Q: Tab Key selecting first item in comboBox ( No Answer,   1 Comment )
Question  
Subject: Tab Key selecting first item in comboBox
Category: Computers > Programming
Asked by: softcom-ga
List Price: $10.00
Posted: 02 Jun 2003 09:34 PDT
Expires: 02 Jul 2003 09:34 PDT
Question ID: 211984
I've written a program in VB.Net that has a number of different
controls on a form.  The tab order has been setup to fit the end users
needs, but the problem occurs when the user uses the tab key to go
from control to control.

Whenever the user tabs to a combobox, if the nothing is selected in
the combobox, then the first item on the list is selected,  This has
only happened since the user changed from Win 98 to Win 2000.  In Win
98 there was no problem at all.

I run Win 2000 and am unable to duplicate the problem, which leads me
to believe that it might be a Win 2000 setting.

I added a textbox to the program to record the events for the
combobox. On my machine I get the following events when the I tab to
the combobox.
Enter
LostFocus
GotFocus

On the users machine I get:
Enter
LostFocus
GotFocus
Keyup

I haven't check all the events, but for some reason it's recording the
tab keyup event.

Any ideas/solutions?

Thanks
Answer  
There is no answer at this time.

Comments  
Subject: Re: Tab Key selecting first item in comboBox
From: snipr-ga on 02 Jun 2003 15:24 PDT
 
I too have Win2k and I was also unable to duplicate the problem you're
experiencing.  One possibility might be to catch the KeyDown event of
the combobox and ignore it if it's the tab key.  I realize that the
textbox does not print the KeyDown event, but it's still something to
try.  Another semi-hackaround would be to set the KeyPreview property
of the parent form to True so that now the form gets to preview all
keys being pressed.  Now, on the KeyDown/KeyUp event of the form you
can check to see if you're on the combobox and respond accordingly by
simulating a real tab like you want.  Again, these are all just
possibilities, I haven't actually tested them as working solutions.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy