About KeyPress method

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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);
}
 
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
 
Back
Top