Public Class logging
    Dim MyName As String ' This variable contains users full name
    Dim MyUName As String ' This variable contains users login name (username)
    Dim MyPass As String ' This variable contains users password
    Dim Response As Integer ' This variable contains users answers from message boxes
    Dim Saved_Name As String ' This variable contains saved username from file
    Dim Saved_Pass As String 'This variable contains saved password from file
    Dim open As String
    Dim NumTries As String ' This variable contains Number that the user will enter password

    Private Sub logging_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FileOpen(1, "Password.txt", OpenMode.Input)
        Saved_Name = LineInput(1)
        Saved_Pass = LineInput(1)

        FileClose(1)

    End Sub

    Private Sub BtnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEnter.Click
        NumTries += 1
        If (Saved_Name = User_NameTextBox.Text And Saved_Pass = PasswordTextBox.Text) Then
            User_NameTextBox.Text = Nothing
            PasswordTextBox.Text = Nothing
            Me.Hide()
            UnitPrice.Show()

        ElseIf NumTries < 3 Then
            MsgBox("Invalid Password!Please try again" & vbCr & "Or the Field Is Empty.", MsgBoxStyle.Critical, )
            User_NameTextBox.Text = ""
            PasswordTextBox.Text = ""
        ElseIf NumTries >= 3 Then
            Beep()
            MsgBox("You are Not Autorized to use this Program!", MsgBoxStyle.Exclamation)
            User_NameTextBox.Enabled = False
            PasswordTextBox.Enabled = False
            User_NameTextBox.Text = ""
            PasswordTextBox.Text = ""
            BtnEnter.Enabled = False
            btnModify.Enabled = False
            Me.Hide()
        End If
    End Sub

    Private Sub btnModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModify.Click
        Form3.Show()
        Me.Hide()

    End Sub
End Class