I tried this code:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (Convert.ToInt32(e.KeyChar) == 13)
{
MessageBox.Show(" Enter pressed ");
}
}
and this:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{
MessageBox.Show(" Enter pressed ");
}
}
and this:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Keys.Enter)
{
MessageBox.Show(" Enter pressed ");
}
}
but they're not working...
When I write something and press Enter, it doesn't work. It only highlights my text.
See Question&Answers more detail:os