还是刚才那个问题
string UserName = "abc ";
string UserPass= "123 ";
string NewPass = "1234 ";
string iNewPass= "1234 ";
string uid, opwd,npwd,ipwd;
uid = TextBox1.Text; opwd = TextBox2.Text; // 获取帐号和密码
npwd = TextBox3.Text; ipwd = TextBox4.Text;
bool pass = false;
if (uid == UserName && opwd == UserPass && opwd == NewPass&& ipwd == iNewPass) //如果登陆成功
{
pass = true; Label6.Text = "恭喜您密码修改成功 ";
}
if (pass == true)
{ Label6.Text = "恭喜您密码修改成功 ";
}
else Label6.Text = "抱歉密码修改错误,请重新修改 ";
} 运行可以,但是即使输入正确的帐号和密码仍然显示,抱歉密码修改错误,请重新修改,这是为什么
------解决方案--------------------改一下这个
uid = TextBox1.Text.Trim(); opwd = TextBox2.Text.Trim();
npwd = TextBox3.Text.Trim(); ipwd = TextBox4.Text.Trim();