Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
One form calling another
Message
 
To
05/02/2001 16:57:47
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
Visual Basic
Category:
Internet applications
Miscellaneous
Thread ID:
00472692
Message ID:
00472795
Views:
31
>Using VB6, I have a search form that displays records in a grid. In the KeyPress() and DblClick() of the grid I issue:
>
> '''
> ln_code = mygrid.Columns.Item(0)
> form2.custno = ln_code
> form2.Show
> '''
>
>If I double click on the grid, the 2nd form displays correctly and has focus.
>
>If I press enter on the grid and my grid's keyPress() is called, the 2nd form displays but focus is returned to the 1st form.
>
>Why does the same code work differently from the DblClick() and Keypress events?
>
>How can I ensure that the 2nd form gets focus and stays on top?
>
>Thanks,
>
>Jerryt

because in the keypress event, the event is triggered before the key is released, launch your other form and come back to continue executing on form1.

Try adding a "keyascii = 0" at the start of the keypress event or use the keyup event.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform