• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1071
  • Last Modified:

if (e.KeyChar == 13)

I came across this line of code:
if (e.KeyChar == 13)

Open in new window

The 13 is carriage return. Is the a C# constant define for this?
0
allelopath
Asked:
allelopath
  • 3
2 Solutions
 
p_davisCommented:
Keys.Return
0
 
p_davisCommented:
System.Windows.Forms.Keys.Return
0
 
allelopathAuthor Commented:
if (e.KeyChar.Equals(Keys.Return)) {

Open in new window

0
 
p_davisCommented:
you will have to cast it to int since it is an enum

or

Keys.Return.GetIntValue()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now