Imports Mediatheek.data
Imports Mediatheek.DataAcces

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 PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents btnLogin As System.Windows.Forms.Button
    Friend WithEvents txtUserNaam As System.Windows.Forms.TextBox
    Friend WithEvents txtPaswoord As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Login))
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.btnLogin = New System.Windows.Forms.Button
        Me.txtUserNaam = New System.Windows.Forms.TextBox
        Me.txtPaswoord = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(-40, 0)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(448, 80)
        Me.PictureBox1.TabIndex = 0
        Me.PictureBox1.TabStop = False
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!)
        Me.Label1.Location = New System.Drawing.Point(24, 96)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(88, 24)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "User naam :"
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!)
        Me.Label2.Location = New System.Drawing.Point(24, 128)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(88, 24)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "Paswoord :"
        '
        'btnLogin
        '
        Me.btnLogin.Location = New System.Drawing.Point(296, 160)
        Me.btnLogin.Name = "btnLogin"
        Me.btnLogin.Size = New System.Drawing.Size(80, 32)
        Me.btnLogin.TabIndex = 3
        Me.btnLogin.Text = "Login"
        '
        'txtUserNaam
        '
        Me.txtUserNaam.Location = New System.Drawing.Point(128, 96)
        Me.txtUserNaam.Name = "txtUserNaam"
        Me.txtUserNaam.Size = New System.Drawing.Size(184, 20)
        Me.txtUserNaam.TabIndex = 4
        Me.txtUserNaam.Text = ""
        '
        'txtPaswoord
        '
        Me.txtPaswoord.Location = New System.Drawing.Point(128, 128)
        Me.txtPaswoord.Name = "txtPaswoord"
        Me.txtPaswoord.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txtPaswoord.Size = New System.Drawing.Size(184, 20)
        Me.txtPaswoord.TabIndex = 5
        Me.txtPaswoord.Text = ""
        '
        'Login
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(398, 203)
        Me.Controls.Add(Me.txtPaswoord)
        Me.Controls.Add(Me.txtUserNaam)
        Me.Controls.Add(Me.btnLogin)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.PictureBox1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.Name = "Login"
        Me.Text = "Login"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
        controleerjuistheidgegevens()
    End Sub

    Private Sub controleerjuistheidgegevens()
        If txtUserNaam.Text <> "" And txtPaswoord.Text <> "" Then
            zoekuser()
        Else
            MsgBox("Gelieve uw username en pasword in te vullen aub !   ")
        End If
    End Sub



    Private Sub zoekuser()
        Dim arlUsers As ArrayList
        arlUsers = clsLoginDA.GetUsers
        Dim bGevonden As Boolean

        For Each oUser As clsUser In arlUsers

            If txtUserNaam.Text.Trim = oUser.UserName.Trim And txtPaswoord.Text.Trim = oUser.UserPassword.Trim Then

                bGevonden = True

            End If

        Next
        If bGevonden = True Then
            openprogramma()

        Else
            MsgBox("Gelieve een juiste username en paswoord in te vullen aub; OPGELET user and paswoord zijn hoofdlettergevoelig !   ")
        End If
    End Sub

    Private Sub openprogramma()
        Me.Hide()
        Dim oProgramma As New frmNew
        oProgramma.Show()


    End Sub


    Private Sub txtPaswoord_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPaswoord.TextChanged
       
    End Sub
End Class
