Guest User

Untitled

a guest
Apr 22nd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.27 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace SimpleLogin
  12. {
  13.     public partial class frmLogin : Form
  14.     {
  15.         string username;
  16.         string password;
  17.         public frmLogin()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.  
  22.         private void btnClose_Click(object sender, EventArgs e)
  23.         {
  24.             this.Close();
  25.         }
  26.  
  27.         private void frmLogin_Load(object sender, EventArgs e)
  28.         {
  29.             progressBarLogin.ForeColor = Color.LightCyan;
  30.             username = txtUsername.Text.Trim();
  31.             password = txtPassword.Text;
  32.         }
  33.         private void btnLogin_Click(object sender, EventArgs e)
  34.         {
  35.            
  36.  
  37.             if (txtUsername.Text.Trim().Equals("EinfachNurCode") && txtPassword.Text.Equals("123456"))
  38.             {
  39.                 timer1.Start();
  40.             }
  41.             else
  42.             {
  43.                 MessageBox.Show("Username or Password is incorrect!", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  44.                 txtUsername.Text = "";
  45.                 txtPassword.Text = "";
  46.             }
  47.  
  48.         }
  49.  
  50.         private void progressBarLogin_Click(object sender, EventArgs e)
  51.         {
  52.  
  53.         }
  54.  
  55.         private void timer1_Tick(object sender, EventArgs e)
  56.         {
  57.             progressBarLogin.Value++;
  58.             lblprogressbar.Text = progressBarLogin.Value + "%";
  59.  
  60.             if(progressBarLogin.Value == 100)
  61.             {
  62.                 timer1.Stop();
  63.                 frmMain main = new frmMain(username);
  64.                 main.Show();
  65.                 this.Hide();
  66.             }
  67.         }
  68.  
  69.         private void txtPassword_TextChanged(object sender, EventArgs e)
  70.         {
  71.  
  72.         }
  73.  
  74.         private void btnHidePW_Click(object sender, EventArgs e)
  75.         {
  76.             if(txtPassword.UseSystemPasswordChar == false)
  77.             {
  78.                 txtPassword.UseSystemPasswordChar = true;
  79.             } else if(txtPassword.UseSystemPasswordChar == true)
  80.             {
  81.                 txtPassword.UseSystemPasswordChar = false;
  82.             }
  83.         }
  84.     }
  85. }
Add Comment
Please, Sign In to add comment