|
-
Feb 20th, 2005, 01:31 PM
#5
Re: Turn OFF Enter Key on CommandButton
 Originally Posted by |2eM!x
you could try:
VB Code:
Private Sub command1_keypress(Keyascii as integer)
if keyascii = 30 then ' i think its 30
then keyascii = 0
end sub
None of these will work. The _Click event fires regardless of what you do. Place a breakpoint
at the start of each of those procedures and you will see that they wont fire from an enter
key being presses, even with Form1.KeyPreview set to True.
Now if the command button does not have the focus and the Default is False
then thats another story.
If you want you can just have the command button never be able to recieve
the focus by setting the TabStop property ot False.
You may have to end up sub-classing the command button and handling the
enter keypress in order to cancel it out if the button in question has the focus.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|