private void loginbtn_Click(object sender, EventArgs e) { MenuForm menu = new MenuForm(); menu.Show(); this.Hide(); // SignUpForm sign = new SignUpForm(); //// sending mail //SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); //smtp.EnableSsl = true; //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Royals12345"); //MailMessage msg = new MailMessage(); //msg.Subject = "Hello " + UserNameTxt.Text + "Login Found"; //msg.Body = "Hi, Thankyou for becoming our customer,now We will Provide You The Latest Update. Thanks"; //string toaddress = textBox1.Text; //msg.To.Add(toaddress); //string fromaddress = "RoyalCafe <*****@*****.**>"; //msg.From = new MailAddress(fromaddress); //try //{ // smtp.Send(msg); //} //catch //{ // throw; // MessageBox.Show("exception");// + exp); //} // SqlConnection con = new SqlConnection("Data Source = DESKTOP - S2LG294\\SQLEXPRESS; Initial Catalog = VplProject; Integrated Security = True"); //SqlCommand cmd = new SqlCommand("select * from LoginDB where UserName='******' and Password='******'", con); // cmd.Parameters.AddWithValue("UserName", UserNameTxt.Text); // cmd.Parameters.AddWithValue("Password", passwordtxt.Text); // SqlDataAdapter sda = new SqlDataAdapter(cmd); // DataTable dt = new DataTable(); // sda.Fill(dt); // con.Open(); // int i = cmd.ExecuteNonQuery(); // con.Close(); // if (dt.Rows.Count > 0) // { // // Session["id"] = TextBox1.Text; // // Response.Redirect("Redirectform.aspx"); // // Session.RemoveAll(); // MenuForm menu = new MenuForm(); // menu.Show(); // this.Hide(); // } // else // { // MenuForm menu = new MenuForm(); // this.Show(); // menu.Hide(); // //Label1.Text = "You're username and word is incorrect"; // //Label1.ForeColor = System.Drawing.Color.Red; // } }