home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,268 of 10,840   
   Rick Rothstein to All   
   Re: KeyPress Event Question   
   10 Mar 05 19:58:30   
   
   From: rickNOSPAMnews@NOSPAMcomcast.net   
      
   > I have a text box for entering in a search string on my form.  I coded   
   the   
   > following KeyPress event handler:   
   >   
   > Private Sub txtFindCall_KeyPress(KeyAscii As Integer)   
   >   
   >     If KeyAscii = 13 Then   
   >         cmdFind_Click   
   >         Exit Sub   
   >     End If   
   >   
   > End Sub   
   >   
   > This allows the user to start the search by hitting the Enter key   
   while in   
   > this text box.  It works fine but my PC sounds a beep when Enter is   
   pressed.   
   >   
   > Can I turn this off?  What does it signify?   
      
   Yes, you can turn it off by adding this line to the If-Then block   
      
       KeyAscii = 0   
      
   The reason it beeps is because the MultiLine property is set to False.   
   If the TextBox can only have a single line, then hitting Enter (go to   
   next line) is considered an error; hence, the beep.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca