Tuesday, 15 July 2014

windows ce - KeyPress Event C# -



windows ce - KeyPress Event C# -

i've got "home" screen 9 buttons. text properties buttons set like: &returns r underlined in display.

so when press r @ home screen want returns screen load. have:

private void frmhome_keypress(object sender, keypresseventargs e) { if (e.keychar == (char)keys.r) { frmreturns r = new frmreturns(empid); r.show(); this.hide(); e.handled = true; } }

but absolutely nothing. can please help?

you should set keypreview property of form true

this.keypreview = true;

otherwise event of pressed key raised in inner controls of form, not in main form.

also, comparing case sensitive. e.keychar == (char)keys.r work r not r.

if(char.toupper(e.keychar) == (char)keys.r)

c# windows-ce device keypress

No comments:

Post a Comment