LogIn.vb

 Public Class LogIn
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    Friend WithEvents btnLogIn As System.Windows.Forms.Button
    Friend WithEvents btnQuit As System.Windows.Forms.Button
    Friend WithEvents lblSAK As System.Windows.Forms.Label
    Friend WithEvents lblUserName As System.Windows.Forms.Label
    Friend WithEvents lblPass As System.Windows.Forms.Label
    Friend WithEvents txtUserName As System.Windows.Forms.TextBox
    Friend WithEvents txtPassword As System.Windows.Forms.TextBox
    Friend WithEvents ep1 As System.Windows.Forms.ErrorProvider
    Friend WithEvents ep2 As System.Windows.Forms.ErrorProvider
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.lblSAK = New System.Windows.Forms.Label
        Me.lblUserName = New System.Windows.Forms.Label
        Me.lblPass = New System.Windows.Forms.Label
        Me.txtUserName = New System.Windows.Forms.TextBox
        Me.txtPassword = New System.Windows.Forms.TextBox
        Me.btnLogIn = New System.Windows.Forms.Button
        Me.btnQuit = New System.Windows.Forms.Button
        Me.ep1 = New System.Windows.Forms.ErrorProvider(Me.components)
        Me.ep2 = New System.Windows.Forms.ErrorProvider(Me.components)
        CType(Me.ep1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.ep2, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'lblSAK
        '
        Me.lblSAK.BackColor = System.Drawing.Color.Moccasin
        Me.lblSAK.Font = New System.Drawing.Font("Monotype Corsiva", 27.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblSAK.ForeColor = System.Drawing.Color.Black
        Me.lblSAK.Location = New System.Drawing.Point(26, 8)
        Me.lblSAK.Name = "lblSAK"
        Me.lblSAK.Size = New System.Drawing.Size(240, 48)
        Me.lblSAK.TabIndex = 0
        Me.lblSAK.Text = "SAK-Developer"
        '
        'lblUserName
        '
        Me.lblUserName.BackColor = System.Drawing.Color.Moccasin
        Me.lblUserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblUserName.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblUserName.Location = New System.Drawing.Point(26, 80)
        Me.lblUserName.Name = "lblUserName"
        Me.lblUserName.Size = New System.Drawing.Size(88, 23)
        Me.lblUserName.TabIndex = 1
        Me.lblUserName.Text = "User Name"
        '
        'lblPass
        '
        Me.lblPass.BackColor = System.Drawing.Color.Moccasin
        Me.lblPass.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblPass.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblPass.Location = New System.Drawing.Point(26, 112)
        Me.lblPass.Name = "lblPass"
        Me.lblPass.Size = New System.Drawing.Size(88, 23)
        Me.lblPass.TabIndex = 2
        Me.lblPass.Text = "Password"
        '
        'txtUserName
        '
        Me.txtUserName.BackColor = System.Drawing.Color.Black
        Me.txtUserName.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtUserName.ForeColor = System.Drawing.Color.White
        Me.txtUserName.Location = New System.Drawing.Point(122, 80)
        Me.txtUserName.MaxLength = 10
        Me.txtUserName.Multiline = True
        Me.txtUserName.Name = "txtUserName"
        Me.txtUserName.Size = New System.Drawing.Size(144, 23)
        Me.txtUserName.TabIndex = 3
        '
        'txtPassword
        '
        Me.txtPassword.BackColor = System.Drawing.Color.Black
        Me.txtPassword.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtPassword.ForeColor = System.Drawing.Color.White
        Me.txtPassword.Location = New System.Drawing.Point(122, 112)
        Me.txtPassword.MaxLength = 6
        Me.txtPassword.Multiline = True
        Me.txtPassword.Name = "txtPassword"
        Me.txtPassword.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
        Me.txtPassword.Size = New System.Drawing.Size(144, 23)
        Me.txtPassword.TabIndex = 4
        '
        'btnLogIn
        '
        Me.btnLogIn.BackColor = System.Drawing.SystemColors.ControlDark
        Me.btnLogIn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnLogIn.Location = New System.Drawing.Point(57, 160)
        Me.btnLogIn.Name = "btnLogIn"
        Me.btnLogIn.Size = New System.Drawing.Size(75, 23)
        Me.btnLogIn.TabIndex = 5
        Me.btnLogIn.Text = "&LogIn"
        Me.btnLogIn.UseVisualStyleBackColor = False
        '
        'btnQuit
        '
        Me.btnQuit.BackColor = System.Drawing.SystemColors.ControlDark
        Me.btnQuit.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnQuit.Location = New System.Drawing.Point(161, 160)
        Me.btnQuit.Name = "btnQuit"
        Me.btnQuit.Size = New System.Drawing.Size(75, 23)
        Me.btnQuit.TabIndex = 6
        Me.btnQuit.Text = "&Quit"
        Me.btnQuit.UseVisualStyleBackColor = False
        '
        'ep1
        '
        Me.ep1.ContainerControl = Me
        '
        'ep2
        '
        Me.ep2.ContainerControl = Me
        '
        'LogIn
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.Turquoise
        Me.ClientSize = New System.Drawing.Size(292, 192)
        Me.ControlBox = False
        Me.Controls.Add(Me.btnQuit)
        Me.Controls.Add(Me.btnLogIn)
        Me.Controls.Add(Me.txtPassword)
        Me.Controls.Add(Me.txtUserName)
        Me.Controls.Add(Me.lblPass)
        Me.Controls.Add(Me.lblUserName)
        Me.Controls.Add(Me.lblSAK)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Name = "LogIn"
        Me.Text = "LogIn"
        CType(Me.ep1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.ep2, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

 
    Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
        If IsNumeric(Me.txtUserName.Text) Then
            MessageBox.Show("Put an alphabetic name please", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error)
            ep1.SetError(txtUserName, "Put an alphabetic name please")
            Me.txtUserName.SelectAll()
            Me.txtUserName.Focus()
            Exit Sub
        End If
        If Me.txtUserName.Text = "" And Me.txtPassword.Text = "" Then
            MessageBox.Show("Put a user name then Put a password please", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error)
            ep1.SetError(txtUserName, "Put a user name please")
            ep2.SetError(txtPassword, "Put a password please")
            Me.txtUserName.Focus()
            Exit Sub
        End If
        If Me.txtUserName.Text = "" Then
            MessageBox.Show("Put a user name please", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error)
            ep1.SetError(txtUserName, "Put a user name please")
            Me.txtUserName.Focus()
            Exit Sub
        End If
        If Me.txtPassword.Text = "" Then
            MessageBox.Show("Put a password please", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error)
            ep2.SetError(txtPassword, "Put a password please")
            Me.txtPassword.Focus()
            Exit Sub
        End If
        Dim f As New MainForm
        MessageBox.Show("Hello" & " " & Me.txtUserName.Text, "WELCOME", MessageBoxButtons.OK, MessageBoxIcon.Information)
        f.ShowDialog()
    End Sub

    Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
        If MessageBox.Show("Do you want to QUIT ?", "Bye Bye ??", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
            Application.Exit()
        End If
    End Sub

    Private Sub LogIn_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CenterToScreen()
    End Sub

    Private Sub txtUserName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUserName.TextChanged
        ep1.SetError(txtUserName, "")
    End Sub

    Private Sub txtPassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPassword.TextChanged
        ep2.SetError(txtPassword, "")
    End Sub
End Class

Project Homepage: