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

How to?

P: n/a
retrieve a Char representing a key value f.e.
Keys.Control?

I must place some keyboard Char into a
keyboard buffer on button click.
Nov 9 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi Jacek,

In the KeyDown event, you could use

char c = (char)e.KeyValue;

but it would not reflect upper or lowercase characters. You may be able
to get casing by testing for Shift, but I'm not sure if you need to to
further testing to get an acceptable result.

char c = (char)e.KeyValue;
if (!e.Shift)
c = Char.ToLower(c);
On Thu, 09 Nov 2006 08:24:31 +0100, Jacek Jurkowski
<jj********@data-comp.euwrote:
retrieve a Char representing a key value f.e.
Keys.Control?

I must place some keyboard Char into a
keyboard buffer on button click.


--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 9 '06 #2

P: n/a
As an alternative... SendKeys accepts modifiers in the string

Marc
Nov 9 '06 #3

P: n/a
The keypressevent gives to the char

HTH Ciaran O'Donnell

"Jacek Jurkowski" wrote:
retrieve a Char representing a key value f.e.
Keys.Control?

I must place some keyboard Char into a
keyboard buffer on button click.
Nov 9 '06 #4

P: n/a
It doesn't give you all keys though, and it doesn't give you the Key value.
On Thu, 09 Nov 2006 10:28:01 +0100, Ciaran O''Donnell
<Ci************@discussions.microsoft.comwrote:
The keypressevent gives to the char

HTH Ciaran O'Donnell

"Jacek Jurkowski" wrote:
>retrieve a Char representing a key value f.e.
Keys.Control?

I must place some keyboard Char into a
keyboard buffer on button click.


--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 9 '06 #5

P: n/a
The problem is that no key is pressed.
The BUTTON is pressed and in it's
Click methood I must raise some event...

Button1.Tag = Keys.Space;

Button1.Click += delegate
{
if(KeyboardKeyPress != null)
{
Keys key = (Keys)Button1.Tag
KeyboardKeyPress(new KeyPressEventArgs(this,?));
}
}

How to parse Keys enum item to Char?
I'm trying to develop an keyborad like thouse
on PDA.
Nov 9 '06 #6

P: n/a
Ok. I was blind for the simpliest sollution.
No more problem ...
Nov 9 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.