Imports System.IO
Imports System.Data
Imports System.Data.OleDb

Public Module Main

#Region "Objects/Variables..."

    Public conn As OleDbConnection
    Private command As OleDbCommand = New OleDbCommand()
    Private dataReader As OleDbDataReader

#End Region

    Public Sub SetConnection()
        conn = New OleDbConnection()
            conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                                    "Data Source=" & Application.StartupPath & "\Database\PhoneBook.mdb;" & _
                                    "Persist Security Info=False;"

        Catch ex As OleDbException
            MessageBox.Show("Error Connecting to Database: " & ex.ErrorCode & " " & ex.Message, InfoMessage.UNEXPECTED_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Public Sub SetAutoCompleteSource(ByVal tableName As String, ByVal fieldName As String, ByVal textBox As System.Windows.Forms.TextBox)
        textBox.AutoCompleteMode = AutoCompleteMode.Suggest
        textBox.AutoCompleteSource = AutoCompleteSource.CustomSource
        Dim sqlString As String = ""

        sqlString = "SELECT * FROM " + tableName + ";"
        command = New OleDbCommand(sqlString, conn)
        command.CommandType = System.Data.CommandType.Text
        dataReader = command.ExecuteReader()

        While (dataReader.Read())

        End While

    End Sub

    Public Class InfoMessage
        Public Const FAILED_DELETE As String = "Failed To Delete Entry"
        Public Const FAILED_UPDATE As String = "Failed To Update Entry"
        Public Const FAILED_ADD As String = "Failed To Add Entry"

        Public Const M_SUCCESSFULLY_DELETED As String = " has been successfully deleted."
        Public Const M_SUCCESSFULLY_UPDATED As String = " has been successfully updated."
        Public Const M_SUCCESSFULLY_ADDED As String = " has been successfully added."

        Public Const C_SUCCESSFULLY_DELETED As String = "Record Deleted"
        Public Const C_SUCCESSFULLY_UPDATED As String = "Record Updated"
        Public Const C_SUCCESSFULLY_ADDED As String = "Record Added"

        Public Const M_DUPLICATED As String = " is already exist. Duplication of data is not allowed."
        Public Const C_DUPLICATED As String = "Duplicate Record"

        Public Const REQUIRED As String = "Required Field"
        Public Const M_CONFIRM_DELETE As String = "Are you sure you want to delete "
        Public Const C_CONFIRM_DELETE As String = "Confirm Delete"
        Public Const C_CONFIRM_MULTIDELETE As String = "Confirm Multiple Delete"
        Public Const UNEXPECTED_ERROR As String = "Unexpected Error Occured"

        Public Const C_NEW_ENTRY As String = "Add New Entry"
        Public Const C_UPDATE_ENTRY As String = "Update Entry"
        Public Const M_NEW_ENTRY As String = "Fill up all the fields then click Save to add new record"
        Public Const M_UPDATE_ENTRY As String = "Fill up all the fields then click Save to update record"
        Public Const C_PRINT_OPTION As String = "Print Option"
        Public Const M_PRINT_OPTION As String = "Select an option below then click OK to proceed."

        Public Const M_NO_RECORD As String = "Sorry, no record found."
        Public Const C_NO_RECORD As String = "No Record"
    End Class

    Public Class Customize

#Region "Constructors"

        Public Sub New()
        End Sub

        Public Sub New(ByVal listView As System.Windows.Forms.ListView, ByVal index As Integer)
            If index Mod 2 <> 0 Then
                listView.Items(index).BackColor = Color.AliceBlue
            End If
        End Sub

        Public Sub New(ByVal listView As System.Windows.Forms.ListView)
            listView.AutoResizeColumn(listView.Columns.Count - 1, ColumnHeaderAutoResizeStyle.HeaderSize)
        End Sub
#End Region

    End Class

End Module

Project Homepage: