更新时间:2023-12-06 11:02:22
使用其他TextBox的Validating事件,此处,仅在用户完成操作后执行代码输入密码.
Use the Validating event of other TextBox, here, the code is only executed when the user has finished entering the password.
您可以使用其他方法,但不能使用textChange来检查两个密码
例如,您可以在method下创建并在button_click中调用它;
you can use another method but no textChange for check two password
for example you can make under method and in button_click call it;
public void CheckTwoPassword(string textbox1,string textbox2)
{
if(textbox1==textbox2)
{
//do some work
}
}
然后您的按钮点击
and your button click
public void Button_Click(sender s,object o)
{
CheckTwoPassword(textbox1.text,textbox2.text);
}
您可以在第二个文本框的"Leave"或"LostFocus"事件中比较密码
Hi,
You can compare passwords in "Leave" or "LostFocus" event of the second textbox