简体   繁体   English

TextBox已更改事件

[英]TextBox Changed event

Instead of immediately calling function when text box is changed. 当文本框更改时,而不是立即调用函数。 I want to wait until a certain word is entered from a string. 我要等到从字符串中输入某个单词。 However the code I have written does not seem to work. 但是,我编写的代码似乎不起作用。 Can anyone inform me f the correct approach to this. 谁能告诉我正确的方法。

private void txtConsole_TextChanged(object sender, EventArgs e)
    {
        string FastModeTest = "";
        if (FastModeTest.IndexOf("ADR=") > -1)
        {
            TestRoutine2();
        }
    }
private void txtConsole_TextChanged(object sender, EventArgs e)
{
     if (txtConsole.Text != "SOMEWORD")
        return;

    // rest
}

this code will cancel this function if certain key is not entered. 如果未输入某些键,此代码将取消此功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM