Here is my example code for if else textbox, my goal is want to make these if else as a public function. So when i want to use these function in other form i just called the public function. Thankyou
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show("Field cannot be empty");
}
else if (textBox1.Text != "admin" && textBox2.Text != "admin")
{
MessageBox.Show("Login invalid");
}
else
{
MessageBox.Show("Login success");
}
}
Aucun commentaire:
Enregistrer un commentaire