By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

disable enter key

P: n/a
Hi,

How do I disable the enter key for a "Form"? so that user has to click the
"Submit" button.
Is there a way of doing it other than using Java/VB script?

Thanks,
Stephen
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I'm not sure about web forms but this is how you would do it for windows
forms..
override the ProcessCmdKey function of the form as below:

Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As _
System.Windows.Forms.Keys) As Boolean
Select Case CType(msg.WParam.ToInt32, Keys)
Case Keys.Enter
'indicates you've handled the message sent by the enter key
press here; basically, you're eating up these messages
Return True
Case Else
Return MyBase.ProcessCmdKey(msg, keyData)
End Select
End Function

I assume you need this functionality for web forms. As I said, I'm not
familiar with that area - Sorry :(
Maybe this would help a bit though...

Imran.

"Stephen" <st*********@hotmail.com> wrote in message
news:ed**************@TK2MSFTNGP11.phx.gbl...
Hi,

How do I disable the enter key for a "Form"? so that user has to click the
"Submit" button.
Is there a way of doing it other than using Java/VB script?

Thanks,
Stephen

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.