Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleMake a CommandButton process clicks and spaces but not carriage returns
KeywordsCommandButton, button, carriage return
CategoriesControls
 
Fire the button in the MouseUp and KeyUp event handlers, not the Click event handler.
 
Private Sub Command1_KeyUp(KeyCode As Integer, Shift As _
    Integer)
    If KeyCode = vbKeySpace Then
        Beep    ' Do something
    End If
End Sub

Private Sub Command1_MouseUp(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    If X >= 0 And X <= Command1.Width And _
       Y >= 0 And Y <= Command1.Height _
    Then
        Beep    ' Do something
    End If
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated