In this blog we will know if a user provides three times wrong login credentials then the login form will be closed.
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;
using System.Data.OleDb;
namespace Invalid_login_three_times
{
public partial
class Form1
: Form
{
string ConnectionString =
System.Configuration.ConfigurationSettings.AppSettings["dsn"];
OleDbCommand com;
OleDbDataAdapter
oledbda;
DataSet ds;
DataTable dt;
string str;
string s1;
int Counter=0;
int i = 0;
int j = 0;
public Form1()
{
InitializeComponent();
}
private void btn_login_Click(object
sender, EventArgs e)
{
if ((txt_userid.Text ==
"") &&
(txt_password.Text==""))
{
MessageBox.Show("Userid and Password cannot be blank");
txt_userid.Focus();
return;
}

Join the conversation! Your thoughts help the community grow.