Pressing a key produce two events in two different forms 
Author Message
 Pressing a key produce two events in two different forms

I have a form that is discharged when the user press a key. To do this  I
have the following code:

Private Sub Form_KeyPress(KeyAscii As Integer)
    Load frmPrincipal
    Unload Me
    frmPrincipal.Show
End Sub

In the form frmPrincipal I have a command button and the event
command1_click is executed automatically due to the key pressed in the
previous form.

How can avoid this behavior? In others words, can I empty the keyboard
buffer or something like that?

Thanks in advanced.



Sat, 23 Oct 1999 03:00:00 GMT  
 Pressing a key produce two events in two different forms

Mikel

Set KeyAscii equal to 0

 Private Sub Form_KeyPress(KeyAscii As Integer)
     KeyAscii=0
     Load frmPrincipal
     Unload Me
     frmPrincipal.Show
 End Sub

Good Luck

--
Thomas Harper

Spam makes me STUTTER.
Clean up the extra letters in the address above
to E-Mail me


Quote:

> I have a form that is discharged when the user press a key. To do this  I
> have the following code:

> Private Sub Form_KeyPress(KeyAscii As Integer)
>     Load frmPrincipal
>     Unload Me
>     frmPrincipal.Show
> End Sub

> In the form frmPrincipal I have a command button and the event
> command1_click is executed automatically due to the key pressed in the
> previous form.

> How can avoid this behavior? In others words, can I empty the keyboard
> buffer or something like that?

> Thanks in advanced.



Sun, 24 Oct 1999 03:00:00 GMT  
 Pressing a key produce two events in two different forms


Quote:

>I have a form that is discharged when the user press a key. To do this  I
>have the following code:

>Private Sub Form_KeyPress(KeyAscii As Integer)
>    Load frmPrincipal
>    Unload Me
>    frmPrincipal.Show
>End Sub

If you really want to do it this way... add the line 'keyascii = 0'
that must do the trick

gr. walther

----- never stop here -----
Walther Musch;http://pi1438.kub.nl:2080/VisualBasicSource/

   Get PR-Tracker -- tracks problem reports, defects, bugs
   INFORMATION:  http://www.halcyon.com/softwise/prtracker.html
   DOWNLOAD:     http://www.halcyon.com/softwise/download.html



Sun, 24 Oct 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Open Two Database with Two System.Mda and Two different User Names and Password

2. Trying to bind data from two different tables to two different controls

3. Trapping two or more keys pressed at the same time

4. Quering two tables in two different files

5. Is that possible to link two tables with different length of the key

6. Linking two different tables on one form WITHOUT using Data Environment Deisgner

7. Run Same Sub From Two Different Forms?

8. Data Controls on two different forms

9. Run Same Sub From Two Different Forms?

10. Two DAO's on different forms referencing the same table

11. Run Same Sub From Two Different Forms?

12. Synchronizing recordsets in two different forms?

 

 
Powered by phpBB® Forum Software