在代码中 txtname.text="" 时,程序就会执行TextChanged事件,如何让它不执行,我们可以定义一个判断条件
Dim ifCF As Boolean = True '是否执行textchanged事件
Private Sub txtname_TextChanged(sender As Object, e As EventArgs) Handles txtname.TextChanged, txttuhao.TextChanged, txtmodel.TextChanged, txtcz.TextChanged
If ifCF = True ThenGetTextValue()
End If
End Sub
在后面的代码我们就用ifCF 来判断
ifCF = False
txtname.text=""
ifCF = True