Imports System.Data.OleDb
Imports System.Object
Public Class frmUser


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

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If MsgBox("Are you sure you want to Add Data?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "WARNING") = MsgBoxResult.Yes Then
            Dim OleDBC As New OleDbCommand
            With OleDBC

                .Connection = conn
                If TextBox1.Text = UPassTextBox.Text Then
                    .CommandText = "Insert Into tblUsers (UserID, UPass, FullName, Address) VALUES ('" & UserIDTextBox.Text & _
                    "','" & UPassTextBox.Text & _
                    "','" & FullNameTextBox.Text & _
                    "','" & AddressTextBox.Text & "')"

                    .ExecuteNonQuery()
                    MsgBox("Data Added!", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "SUCCESS")
                Else
                    MsgBox("Password Mismatch")
                End If
                Me.Hide()
                conn.Close()
                AddressTextBox.Enabled = False
                FullNameTextBox.Enabled = False
                UPassTextBox.Enabled = False
                UserIDTextBox.Enabled = False
            End With

        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        AddressTextBox.Text = ""
        FullNameTextBox.Text = ""
        UPassTextBox.Text = ""
        UserIDTextBox.Text = ""
        AddressTextBox.Enabled = True
        FullNameTextBox.Enabled = True
        UPassTextBox.Enabled = True
        UserIDTextBox.Enabled = True

        Call DisconnectDatabase()
        Me.Hide()
    End Sub
End Class