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);
     }
 }
        private void frm_patient_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F3)
            {
                Button1_Click(sender, e);
            }
            else if (e.Alt && e.Control && e.KeyCode == Keys.A)
            {
                int randomno = RandomNumber(111111, 999999);
                //MessageBox.Show(randomno.ToString());
                WhatsApp.Send("Patient Id: " + patid + "\nDated: " + rdate + "\nOTP for Modification is " + randomno.ToString());
                send = true;
                InputBox box = new InputBox("Type OTP", "", false);
                box.outStr        = "OTP";
                box.random        = randomno;
                box.ShowInTaskbar = false;
                box.ShowDialog(this);

                if (box.match == true)
                {
                    TextBox1.Enabled = true;
                    // textBox4.Enabled = true;
                    TextBox1.TextBoxEnter();
                    TextBox1.Focus();

                    alter = true;
                }
            }

            if (e.KeyCode == Keys.Escape)
            {
                if (TextBox1.Text != "")
                {
                    DialogResult chk = MessageBox.Show("Are u sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (chk == DialogResult.No)
                    {
                        e.Handled = false;
                    }
                    else
                    {
                        this.Dispose();
                    }
                }
                else
                {
                    this.Dispose();
                }
            }
        }
 private void TextBox1_Enter(object sender, EventArgs e)
 {
     TextBox1.TextBoxEnter();
 }