Hi Suresh,
you can try this
static int intCounter = 0;
intCounter = intCounter + 1;
textBox1.Text = "";
textBox2.Text = "";
textBox2.Text = "*";
if ((intCounter < 3))
{
if ((textBox2.Text == "password" && textBox2.Text == "User"))
{
MessageBox.Show("User name and password are correct");
}
else
{
str = Convert.ToString(3 - intCounter);
MessageBox.Show("User name or password incorrect! You have " + str + " tries left.");
}
}
else
{
MessageBox.Show("User name or password incorrect! You have no attempts remaining and the system is locked.");
Application.Exit();
}