Click here to Skip to main content
15,913,944 members
Home / Discussions / C#
   

C#

 
GeneralRe: tricky sql & data set question Pin
A.Wegierski24-Aug-03 22:29
A.Wegierski24-Aug-03 22:29 
GeneralI formated my drive along with my project Pin
mdolby19-Aug-03 10:11
mdolby19-Aug-03 10:11 
GeneralRe: I formated my drive along with my project Pin
J. Dunlap19-Aug-03 10:18
J. Dunlap19-Aug-03 10:18 
QuestionHow do I find a file associated icon? Pin
Lars Fisker19-Aug-03 9:17
Lars Fisker19-Aug-03 9:17 
AnswerRe: How do I find a file associated icon? Pin
Heath Stewart19-Aug-03 9:46
protectorHeath Stewart19-Aug-03 9:46 
GeneralRe: How do I find a file associated icon? Pin
Lars Fisker19-Aug-03 10:48
Lars Fisker19-Aug-03 10:48 
QuestionTrapping the enter key? Pin
BoozeBomb19-Aug-03 8:57
BoozeBomb19-Aug-03 8:57 
AnswerRe: Trapping the enter key? Pin
Heath Stewart19-Aug-03 9:14
protectorHeath Stewart19-Aug-03 9:14 
So many questions - so little time!

First, you can trap the Enter key with the keyboard events. You can capture the key with the KeyDown or KeyUp events on the Form, while setting Form.KeyPreview to true if you want it to receive notification of keyboard events from all controls (it's the parent HWND in the chain to be notified of messages if controls let them).

KeyUp would probably be better because it gives a (knowledgeable) user the chance to cancel the event with the Esc key.

Each of these events has a KeyEventArgs.KeyCode that corresponds to a Keys enumeration. You most likely shouldn't hardcode the ASCII key code because those can change with different codepages. .NET (and the Windows subsystem that drives it) takes a lot of this into account. Most likely the key code won't change for the Enter key, but why take the chance when it's so easy to just use the enumeration?

If you want the ASCII keys anyway (bad bad bad!) or for some other reason, just type "ASCII" into the help index - you know, the think you should've checked first. You'll see "ASCII character sets" (and many other links) that have the ASCII charts of 0-127 and 128-256.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Trapping the enter key? Pin
BoozeBomb19-Aug-03 9:25
BoozeBomb19-Aug-03 9:25 
Generalasync delegates Pin
devvvy19-Aug-03 8:32
devvvy19-Aug-03 8:32 
GeneralRe: async delegates Pin
Heath Stewart19-Aug-03 9:26
protectorHeath Stewart19-Aug-03 9:26 
Generalsending mail with attachments Pin
Sprinkle19-Aug-03 7:57
Sprinkle19-Aug-03 7:57 
GeneralRe: sending mail with attachments Pin
Heath Stewart19-Aug-03 9:53
protectorHeath Stewart19-Aug-03 9:53 
QuestionDetermining radio button choice...??? Pin
vlusardi19-Aug-03 7:33
vlusardi19-Aug-03 7:33 
AnswerRe: Determining radio button choice...??? Pin
Heath Stewart19-Aug-03 9:56
protectorHeath Stewart19-Aug-03 9:56 
GeneralGIS in C# Pin
laphijia19-Aug-03 7:07
laphijia19-Aug-03 7:07 
GeneralUsing ActiveX control in C# Pin
Big Trev19-Aug-03 6:43
Big Trev19-Aug-03 6:43 
GeneralRe: Using ActiveX control in C# Pin
Stephane Rodriguez.19-Aug-03 8:45
Stephane Rodriguez.19-Aug-03 8:45 
GeneralRe: Using ActiveX control in C# Pin
Heath Stewart19-Aug-03 10:03
protectorHeath Stewart19-Aug-03 10:03 
GeneralRe: Using ActiveX control in C# Pin
Big Trev19-Aug-03 21:32
Big Trev19-Aug-03 21:32 
GeneralRe: Using ActiveX control in C# Pin
Heath Stewart20-Aug-03 2:26
protectorHeath Stewart20-Aug-03 2:26 
GeneralRe: Using ActiveX control in C# Pin
Big Trev20-Aug-03 2:44
Big Trev20-Aug-03 2:44 
GeneralMicrosoft Word automation Pin
Radoslav Bielik19-Aug-03 6:35
Radoslav Bielik19-Aug-03 6:35 
GeneralRe: Microsoft Word automation Pin
Stephane Rodriguez.19-Aug-03 6:42
Stephane Rodriguez.19-Aug-03 6:42 
GeneralRe: Microsoft Word automation Pin
Radoslav Bielik19-Aug-03 7:16
Radoslav Bielik19-Aug-03 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.