9 Question
9 Question
Program:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LoginFormSetup
{
public partial class Form1 : Form
{
string[] email = { "[email protected]", "[email protected]",
"[email protected]", "[email protected]" };
string[] password = { "Zaid@123", "Fahad@123", "Ali@123", "Abdul@123" };
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int check = 0;
string loggedinUser="";
for(int i=0;i<4;i++)
{
if(this.textBox1.Text == email[i] && this.textBox2.Text == password[i])
{
check++;
loggedinUser = email[i];
}
}
if (check == 0)
{
MessageBox.Show("Incorrect email or password");
}
else
{
MessageBox.Show(loggedinUser+" Welcome | You are Logged in");
}
}
}
}
1
outputs:
output if login credentials are right and system show you are
logged in