Imports System.Data.OleDb
Public Class Form3

    Private Sub Form3_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

    End Sub

    Private Sub Form3_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Try
            If e.CloseReason = CloseReason.UserClosing Then
            

                End

            End If
        Catch
        End Try
    End Sub

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        End
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Try
            Dim conn As OleDbConnection
            Dim SQL As OleDbCommand
            Dim RSet As OleDbDataReader
            Dim User As String = ""
            Dim Pass As String = ""
            Dim Server As String = ""
            Dim Resp As String = ""
            conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App_Path() & "progdb.mdb;")
            conn.Open()
            SQL = New OleDbCommand("select Server, UserID, Pass From Settings", conn)
            RSet = SQL.ExecuteReader
            If RSet.HasRows = False Then
                Exit Sub
            End If
            While RSet.Read
                Server = RSet("Server").ToString
                User = RSet("UserID").ToString
                Pass = RSet("Pass").ToString

            End While
            RSet.Close()

            If TextBox1.Text = "" Or TextBox2.Text = "" Then
                MsgBox("Please complete all fields.", MsgBoxStyle.Information)
                Exit Sub
            Else
                Resp = Functions.Connect(Server + "/client/usercheck.asp", TextBox1.Text, TextBox2.Text)
                If Resp = "Offline" Then
                    MsgBox("Not available offline.", MsgBoxStyle.Information)
                    Exit Sub
                End If

                If Resp = "nouser" Then
                    MsgBox("The user name or password is incorrect.", MsgBoxStyle.Information)
                ElseIf Resp = "okuser" Then
                    SQL = New OleDbCommand("UPDATE Settings SET UserID = '" & TextBox1.Text & "', Pass = '" + TextBox2.Text + "'", conn)
                    RSet = SQL.ExecuteReader
                    RSet.Close()
                    Form1.Show()
                    Me.Dispose()
                End If

            End If

            conn.Close()
        Catch
            Functions.CreateError(Err.Description + " " + Err.Source, Err.Number)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        CloseOrNot = "Dink"
        Form2.Show()
        Me.Dispose()

    End Sub

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Dim conn As OleDbConnection
        Dim SQL As OleDbCommand
        Dim RSet As OleDbDataReader
        conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App_Path() & "progdb.mdb;")
        conn.Open()
        SQL = New OleDbCommand("select Server, UserID From Settings", conn)
        RSet = SQL.ExecuteReader
        If RSet.HasRows = False Then
        End If
        While RSet.Read
            Process.Start(RSet("Server").ToString + "/passlook.asp")
        End While
        RSet.Close()
        conn.Close()
    End Sub

    Private Sub LinkLabel1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel1.MouseEnter
        LinkLabel1.LinkColor = Color.Red
    End Sub

    Private Sub LinkLabel1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel1.MouseLeave
        LinkLabel1.LinkColor = Color.DarkSlateGray
    End Sub
End Class