About KeyPress method

G

Guest

hello everyone,
We are know that there is a KeyCode parameter in the Keypress method of VB6.
the KeyCode can make us to change its value,
for example, KeyCode=KeyCode + 10 etc.
however, I can not use like this in the C#.
so, how to realize the method like in the VB6.
thank you.
 
A

Arne Schittenhelm

hello everyone,
We are know that there is a KeyCode parameter in the Keypress method of VB6.
the KeyCode can make us to change its value,
for example, KeyCode=KeyCode + 10 etc.
however, I can not use like this in the C#.
so, how to realize the method like in the VB6.
thank you.

Do yu mean something like this?

private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
e.Handled = true;
textBox1.Text += (char)(Convert.ToInt16(e.KeyChar) + 10);
}
 
G

Guest

Thank you at first.
But, it only add a char at the end of text.
for example,
abcd
than input 'e', the text is
abcde
next, move the cursor to the b, and insert 'f', the text is
abcdef
not like this
abfcde
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top