Why my textbox TextChanged event gets fired after I enter “only” one character in my text box?

后端 未结 2 1225
慢半拍i
慢半拍i 2021-01-13 08:46
private void NameVal_TextChanged(object sender, EventArgs e)
    {
        String text = NameVal.Text;

    }

As soon as I enter the first letter o

2条回答
  •  孤街浪徒
    2021-01-13 09:06

    If you want to determine when the user has finished typing, you can catch the leave event instead - this is fired when the focus is lost on that text box - ie the user clicks outside of the textbox:

    private void NameVal_Leave(object sender, EventArgs e)
    {
        //Do your stuff
        String text = NameVal.Text;
    }
    

提交回复
热议问题