Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace Gwenchaners_Voting_System_Project
- {
- public partial class LogInPage : Form
- {
- SqlConnection con = new SqlConnection();
- SqlCommand com = new SqlCommand();
- public LogInPage()
- {
- InitializeComponent();
- con.ConnectionString = @"Data Source=DESKTOP-NDPHD3N;Initial Catalog=UserVoters;Integrated Security=True";
- }
- private void btnLogin_Click(object sender, EventArgs e)
- {
- con.Open();
- com.Connection = con;
- com.CommandText = "select * from UserInfo";
- if (dr.Read())
- {
- if (txtboxIDNo.Text.Equals(dr["ID Number"].ToString()) && txtboxPassword.Text.Equals(dr["Password"].ToString()))
- {
- this.Hide();
- Homepage homepage = new Homepage();
- homepage.Show();
- }
- else
- {
- MessageBox.Show("Either your ID Number or your Password is Incorrect. Please Try Again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- con.Close();
- }
- private void txtboxIDNo_TextChanged(object sender, EventArgs e)
- {
- if (txtboxIDNo.Text.Equals("IDNo"))
- {
- txtboxIDNo.Text = "";
- }
- }
- private void txtboxPassword_TextChanged(object sender, EventArgs e)
- {
- if (txtboxPassword.Text.Equals("Password"))
- {
- txtboxPassword.Text = "";
- }
- }
- private void checkBoxShowPassword_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBoxShowPassword.Checked == true)
- {
- txtboxPassword.UseSystemPasswordChar = false;
- }
- else
- {
- txtboxPassword.UseSystemPasswordChar = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement