private void TextBox1_Leave(object sender, EventArgs e) { if (TextBox1.Text.Trim() == "") { TextBox1.TextBoxEnter(); } else { TextBox1.Text = TextBox1.Text.ToUpper(); TextBox1.TextBoxLeave(); } }
private void TextBox1_KeyDown(object sender, KeyEventArgs e) { if (TextBox1.Text.Trim() == "" && e.KeyCode == Keys.Enter) { TextBox1.TextBoxEnter(); MessageBox.Show("Enter Patient Name"); } else { TextBox1.TextBoxLeave(); this.Enter2Tab(e); } }