C# password entry

Posted: July 15, 2014 in C#
Tags: ,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication27
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

int trial ;
int total_trial;

private void button1_Click(object sender, EventArgs e)
{

total_trial = 5;
if (textBox1.Text == “12345”)
{
MessageBox.Show(“You are logged in to the system”);
}
else
{
trial =trial + 1;
MessageBox.Show(“invalid attempt try again ” +
(total_trial – trial) + ” trial!!!”);
if (trial == 5) Application.Exit();
}
}

}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s