-4
Guys, I have a question that I think you guys are gonna figure out.
I have a login form of this with the following condition:
private void button1_Click(object sender, EventArgs e)
{
if (textBox2.Text == "1234" || textBox3.Text == "1234")
{
PDVForm form = new PDVForm(textBox1.Text);
this.Hide();
form.Closed += (s, args) => this.Close();
form.Show();
}
else
{
MessageBox.Show("Usuário ou Senha Incorreta", "Erro",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
}
however I will have to make him change the if code:
if (textBox2.Text == "1234" || textBox3.Text == "1234")
In the part of 1234 that is the login and the initial password, however if the user wants to change the part of 1234 what the code?
I’ll put it in the login form to get the text of another form, and so it will have the new login and password, but I can not make this code change the passage 1234
private void button1_Click(object sender, EventArg e)
{
//Aqui vai o codigo de pegar o texto do campo textBox1
//Aqui vai o codigo de pegar o texto do campo textBox2
//Qual o codigo de mudar o 1234 para o texto digitado?
}
If you’ve solved your problem, consider marking this answer as correct, just below the voting buttons.
– CypherPotato
Consider using the operator
&&
, in place of&
. In this case it is not necessary to evaluate the 2nd part if the 1st part is already false. https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/boolean-logical-operators#conditional-Logical-and-Operator-– tvdias
@tvdias thanks for the suggestion.
– CypherPotato