private void button1_Click(object sender, EventArgs e) { this.Hide(); TextChk tc = new TextChk(); tc.Show(); }
private void button4_Click(object sender, EventArgs e) { if (chk < 3) { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Vishwas\Documents\TLPAS\data.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"); SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From COLOR where val='" + textBox1.Text + "'", con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Hide(); MessageBox.Show("Login Successfull"); picChk pchk = new picChk(); pchk.Show(); } else { MessageBox.Show("Please Check Your Username and Password"); chk += 1; } } else { MessageBox.Show("Sorry you have entered wrong password three times"); this.Hide(); TextChk tc = new TextChk(); tc.Show(); chk = 0; } }