|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Default check boxI am using the graphical style of a check box to get a button on a form. Is
there a way to make one of these the one that is selected when the Enter key is pressed? -Dan You could set the KeyPreview property of the form to true and trap the
return key being pressed in the form's KeyPress event. This will not work if there is a command button on the form with its Default property set to true. Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyReturn Then chkCheck1.Value = vbChecked End If End Sub -- Show quoteHide quoteChris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp -- Read. Decide. Sign the petition to Microsoft. http://classicvb.org/petition/ "Dan" <D**@discussions.microsoft.com> wrote in message news:C101CC75-09CE-46F3-9C0E-199D7409131A@microsoft.com... > I am using the graphical style of a check box to get a button on a form. Is > there a way to make one of these the one that is selected when the Enter key > is pressed? > > -Dan Thank you! I'll try what you suggested.
-Dan Show quoteHide quote "Veign" wrote: > You could set the KeyPreview property of the form to true and trap the > return key being pressed in the form's KeyPress event. This will not work > if there is a command button on the form with its Default property set to > true. > > Private Sub Form_KeyPress(KeyAscii As Integer) > > If KeyAscii = vbKeyReturn Then > chkCheck1.Value = vbChecked > End If > > End Sub > > -- > Chris Hanscom - Microsoft MVP (VB) > Veign's Resource Center > http://www.veign.com/vrc_main.asp > -- > Read. Decide. Sign the petition to Microsoft. > http://classicvb.org/petition/ > > > "Dan" <D**@discussions.microsoft.com> wrote in message > news:C101CC75-09CE-46F3-9C0E-199D7409131A@microsoft.com... > > I am using the graphical style of a check box to get a button on a form. > Is > > there a way to make one of these the one that is selected when the Enter > key > > is pressed? > > > > -Dan > > >
Other interesting topics
VBclassic petition
Draw line on picture; change width Class_Terminate problem & Run-time error'424': Object required determining a rising\falling trend MkDir with blanks Creating a Toolbar Working application - Now generates error help with passing values from an aspx page? Duplicate forms about dll ?? |
|||||||||||||||||||||||