Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 6.33 KB | None | 0 0
  1. Public Class Form1
  2.     Inherits System.Windows.Forms.Form
  3.     Dim hey As New form2
  4.  
  5.  
  6.  
  7. #Region " Windows Form Designer generated code "
  8.  
  9.     Public Sub New()
  10.         MyBase.New()
  11.  
  12.         'This call is required by the Windows Form Designer.
  13.         InitializeComponent()
  14.  
  15.         'Add any initialization after the InitializeComponent() call
  16.  
  17.     End Sub
  18.  
  19.     'Form overrides dispose to clean up the component list.
  20.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  21.         If disposing Then
  22.             If Not (components Is Nothing) Then
  23.                 components.Dispose()
  24.             End If
  25.         End If
  26.         MyBase.Dispose(disposing)
  27.     End Sub
  28.  
  29.     'Required by the Windows Form Designer
  30.     Private components As System.ComponentModel.IContainer
  31.  
  32.     'NOTE: The following procedure is required by the Windows Form Designer
  33.     'It can be modified using the Windows Form Designer.  
  34.     'Do not modify it using the code editor.
  35.     Friend WithEvents Label1 As System.Windows.Forms.Label
  36.     Friend WithEvents Label2 As System.Windows.Forms.Label
  37.     Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
  38.     Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
  39.     Friend WithEvents Button1 As System.Windows.Forms.Button
  40.     Friend WithEvents Button2 As System.Windows.Forms.Button
  41.     Friend WithEvents Button3 As System.Windows.Forms.Button
  42.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  43.         Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
  44.         Me.Label1 = New System.Windows.Forms.Label
  45.         Me.Label2 = New System.Windows.Forms.Label
  46.         Me.TextBox1 = New System.Windows.Forms.TextBox
  47.         Me.TextBox2 = New System.Windows.Forms.TextBox
  48.         Me.Button1 = New System.Windows.Forms.Button
  49.         Me.Button2 = New System.Windows.Forms.Button
  50.         Me.Button3 = New System.Windows.Forms.Button
  51.         Me.SuspendLayout()
  52.         '
  53.         'Label1
  54.         '
  55.         Me.Label1.BackColor = System.Drawing.Color.Transparent
  56.         Me.Label1.ForeColor = System.Drawing.Color.DarkGray
  57.         Me.Label1.Location = New System.Drawing.Point(40, 48)
  58.         Me.Label1.Name = "Label1"
  59.         Me.Label1.Size = New System.Drawing.Size(72, 24)
  60.         Me.Label1.TabIndex = 0
  61.         Me.Label1.Text = "USERNAME:"
  62.         '
  63.         'Label2
  64.         '
  65.         Me.Label2.BackColor = System.Drawing.Color.Transparent
  66.         Me.Label2.ForeColor = System.Drawing.Color.DarkGray
  67.         Me.Label2.Location = New System.Drawing.Point(40, 72)
  68.         Me.Label2.Name = "Label2"
  69.         Me.Label2.Size = New System.Drawing.Size(80, 24)
  70.         Me.Label2.TabIndex = 1
  71.         Me.Label2.Text = "PASSWORD:"
  72.         '
  73.         'TextBox1
  74.         '
  75.         Me.TextBox1.Location = New System.Drawing.Point(128, 40)
  76.         Me.TextBox1.Name = "TextBox1"
  77.         Me.TextBox1.Size = New System.Drawing.Size(120, 20)
  78.         Me.TextBox1.TabIndex = 2
  79.         Me.TextBox1.Text = ""
  80.         '
  81.         'TextBox2
  82.         '
  83.         Me.TextBox2.Location = New System.Drawing.Point(128, 72)
  84.         Me.TextBox2.Name = "TextBox2"
  85.         Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(164)
  86.         Me.TextBox2.Size = New System.Drawing.Size(120, 20)
  87.         Me.TextBox2.TabIndex = 3
  88.         Me.TextBox2.Text = ""
  89.         '
  90.         'Button1
  91.         '
  92.         Me.Button1.ForeColor = System.Drawing.Color.Black
  93.         Me.Button1.Location = New System.Drawing.Point(24, 120)
  94.         Me.Button1.Name = "Button1"
  95.         Me.Button1.Size = New System.Drawing.Size(80, 24)
  96.         Me.Button1.TabIndex = 4
  97.         Me.Button1.Text = "OK"
  98.         '
  99.         'Button2
  100.         '
  101.         Me.Button2.ForeColor = System.Drawing.Color.Black
  102.         Me.Button2.Location = New System.Drawing.Point(112, 120)
  103.         Me.Button2.Name = "Button2"
  104.         Me.Button2.Size = New System.Drawing.Size(80, 24)
  105.         Me.Button2.TabIndex = 5
  106.         Me.Button2.Text = "Cancel"
  107.         '
  108.         'Button3
  109.         '
  110.         Me.Button3.ForeColor = System.Drawing.Color.Black
  111.         Me.Button3.Location = New System.Drawing.Point(200, 120)
  112.         Me.Button3.Name = "Button3"
  113.         Me.Button3.Size = New System.Drawing.Size(72, 24)
  114.         Me.Button3.TabIndex = 6
  115.         Me.Button3.Text = "Reset"
  116.         '
  117.         'Form1
  118.         '
  119.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  120.         Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
  121.         Me.ClientSize = New System.Drawing.Size(296, 166)
  122.         Me.Controls.Add(Me.Button3)
  123.         Me.Controls.Add(Me.Button2)
  124.         Me.Controls.Add(Me.Button1)
  125.         Me.Controls.Add(Me.TextBox2)
  126.         Me.Controls.Add(Me.TextBox1)
  127.         Me.Controls.Add(Me.Label2)
  128.         Me.Controls.Add(Me.Label1)
  129.         Me.ForeColor = System.Drawing.Color.FromArgb(CType(0, Byte), CType(0, Byte), CType(0, Byte), CType(5, Byte))
  130.         Me.Name = "Form1"
  131.         Me.Text = "Login Form"
  132.         Me.ResumeLayout(False)
  133.  
  134.     End Sub
  135.  
  136. #End Region
  137.  
  138.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  139.         TextBox1.Clear()
  140.         TextBox2.Clear()
  141.     End Sub
  142.  
  143.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  144.         End
  145.     End Sub
  146.  
  147.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  148.         Dim identifier As Integer = 0
  149.  
  150.         If Not TextBox1.Text = "John Bernie" Then
  151.             identifier = 1
  152.             MsgBox("Wrong Username", MsgBoxStyle.Exclamation, "Login")
  153.             TextBox1.Clear()
  154.         End If
  155.  
  156.         If Not TextBox2.Text = "07500163" Then
  157.             identifier = 1
  158.             MsgBox("Wrong Password", MsgBoxStyle.Exclamation, "Login")
  159.             TextBox2.Clear()
  160.         End If
  161.  
  162.         If identifier = 0 Then
  163.             hey.TextBox1.Text = "John Bernie"
  164.             hey.TextBox2.Text = "07500163"
  165.             hey.Show()
  166.             Me.Hide()
  167.             TextBox1.Clear()
  168.             TextBox2.Clear()
  169.         End If
  170.     End Sub
  171.  
  172.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  173.         TextBox1.Clear()
  174.         TextBox2.Clear()
  175.     End Sub
  176. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement