Winform中Load与TextChanged事件冲突问题

Load里加载内容,之后会触发敏感、脆弱的TextChanged事件,造成冲突

解决办法:

 bool isFirstPostBack = true;
 Load 代码段内尾部增加
 isFirstPostBack = false;
private void comboBox1_TextChanged(object sender, EventArgs e)
        {
           if (isFirstPostBack)
            {
                return;
            }
}


你可能感兴趣的:(Winform中Load与TextChanged事件冲突问题)