Imports System.Windows.Forms
Imports System.Data.OleDb


Public Class frmLogon
    Inherits 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 lblID As System.Windows.Forms.Label
    Friend WithEvents lblPaswoord As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents btnok As System.Windows.Forms.Button
    Friend WithEvents btncancel As System.Windows.Forms.Button
    Friend WithEvents txtid As System.Windows.Forms.TextBox
    Friend WithEvents txtpaswoord As System.Windows.Forms.TextBox
    Friend WithEvents lblstatus As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.lblID = New System.Windows.Forms.Label()
        Me.lblPaswoord = New System.Windows.Forms.Label()
        Me.txtid = New System.Windows.Forms.TextBox()
        Me.txtpaswoord = New System.Windows.Forms.TextBox()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.btnok = New System.Windows.Forms.Button()
        Me.btncancel = New System.Windows.Forms.Button()
        Me.lblstatus = New System.Windows.Forms.Label()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'lblID
        '
        Me.lblID.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblID.Location = New System.Drawing.Point(24, 24)
        Me.lblID.Name = "lblID"
        Me.lblID.Size = New System.Drawing.Size(88, 24)
        Me.lblID.TabIndex = 0
        Me.lblID.Text = "User ID : "
        Me.lblID.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'lblPaswoord
        '
        Me.lblPaswoord.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblPaswoord.Location = New System.Drawing.Point(24, 72)
        Me.lblPaswoord.Name = "lblPaswoord"
        Me.lblPaswoord.Size = New System.Drawing.Size(88, 24)
        Me.lblPaswoord.TabIndex = 1
        Me.lblPaswoord.Text = "Paswoord : "
        Me.lblPaswoord.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'txtid
        '
        Me.txtid.Location = New System.Drawing.Point(128, 24)
        Me.txtid.MaxLength = 7
        Me.txtid.Name = "txtid"
        Me.txtid.Size = New System.Drawing.Size(104, 20)
        Me.txtid.TabIndex = 2
        Me.txtid.Text = ""
        '
        'txtpaswoord
        '
        Me.txtpaswoord.Location = New System.Drawing.Point(128, 72)
        Me.txtpaswoord.Name = "txtpaswoord"
        Me.txtpaswoord.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txtpaswoord.Size = New System.Drawing.Size(104, 20)
        Me.txtpaswoord.TabIndex = 3
        Me.txtpaswoord.Text = ""
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblID, Me.lblPaswoord, Me.txtid, Me.txtpaswoord})
        Me.GroupBox1.Location = New System.Drawing.Point(16, 32)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(264, 112)
        Me.GroupBox1.TabIndex = 4
        Me.GroupBox1.TabStop = False
        '
        'btnok
        '
        Me.btnok.Location = New System.Drawing.Point(16, 152)
        Me.btnok.Name = "btnok"
        Me.btnok.Size = New System.Drawing.Size(72, 24)
        Me.btnok.TabIndex = 5
        Me.btnok.Text = "OK"
        '
        'btncancel
        '
        Me.btncancel.Location = New System.Drawing.Point(200, 152)
        Me.btncancel.Name = "btncancel"
        Me.btncancel.Size = New System.Drawing.Size(80, 24)
        Me.btncancel.TabIndex = 6
        Me.btncancel.Text = "Cancel"
        '
        'lblstatus
        '
        Me.lblstatus.Location = New System.Drawing.Point(64, 8)
        Me.lblstatus.Name = "lblstatus"
        Me.lblstatus.Size = New System.Drawing.Size(176, 16)
        Me.lblstatus.TabIndex = 7
        Me.lblstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'frmLogon
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 189)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblstatus, Me.btncancel, Me.btnok, Me.GroupBox1})
        Me.Name = "frmLogon"
        Me.Text = "Geef user ID en paswoord in"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Dim test As Boolean
    Public controle As Boolean


    Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click



access:
        If txtid.Text <> "" AndAlso txtpaswoord.Text <> "" Then
            'alle menus enablen en logon afsluiten

            ' verbindin met database wachtwoord

            test = LogonBeheer.logon(txtid.Text, txtpaswoord.Text)

            If test = True Then
                
                controle = True
                MessageBox.Show("Successvol aangelogd" & vbCrLf & "Klik op Activeer onder File", "Logon", MessageBoxButtons.OK, MessageBoxIcon.Information)

                Me.Hide()


            Else : MessageBox.Show("Verkeerde username of paswoord", "Log in", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                txtid.Clear()
                txtpaswoord.Clear()
                txtid.Focus()
                controle = False
                GoTo access

            End If



        Else : txtid.Focus()

            lblstatus.Text = "U moet de velden invullen!"
            controle = False

        End If

    End Sub

    Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancel.Click


        Me.Hide() 'me altijd gebruiken vr sluiten van instantie

    End Sub




End Class
