Textbox not clickable but editable

后端 未结 4 1737
攒了一身酷
攒了一身酷 2021-01-27 09:43

I have a small form with 10 textboxes, I have them set in the right Tab Order currently the way I want them to Tab To. I was wondering if there is a way to set the textboxes up

4条回答
  •  滥情空心
    2021-01-27 10:24

    You can also try this one with the Enter event foreach TextBox

        private void textBox2_Enter(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
                textBox1.Focus();
        }
    
        private void textBox3_Enter(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
                textBox1.Focus();
            else
                if (textBox2.Text == "")
                    textBox2.Focus();
        }
    
        private void textBox4_Enter(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
                textBox1.Focus();
            else
                if (textBox2.Text == "")
                    textBox2.Focus();
                else
                    if (textBox3.Text == "")
                        textBox3.Focus();
        }
    

提交回复
热议问题