Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 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 WindowsFormsApplication1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Form1_Load(object sender, EventArgs e)
  21.         {
  22.  
  23.         }
  24.  
  25.  
  26.         private void button1_Click(object sender, EventArgs e)
  27.         {
  28.             string username = "admin";
  29.             string pass = "admin";
  30.  
  31.             if ((textBox1.Text == username) && (textBox2.Text == pass))
  32.             {
  33.                 MessageBox.Show("Login Sucess");
  34.                 this.Hide();
  35.                 Form2 f2 = new Form2();
  36.                 f2.Show();
  37.                 this.Hide();
  38.                 f2.ShowDialog();
  39.                 Close();
  40.  
  41.  
  42.             }
  43.                
  44.  
  45.        
  46.             else{
  47.                 MessageBox.Show("Enter valid username and password!");
  48.  
  49.             }
  50.                
  51.         }
  52.     }
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement