private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (char.IsLetter(e.KeyChar) && !char.IsUpper(e.KeyChar)) { e.KeyChar = char.ToUpper(e.KeyChar); } }