Imports System.IO Module ModuleUserSavings Public PATH_FileExclusions As String = Path.Combine(Application.UserAppDataPath(), "FileExclusions.xml") Public Function LoadFileExclusion() Dim rowresult As String = "" Try 'if file doesn't exist, create the file with its default xml table If Not File.Exists(path_FileExclusions) Then DTEXCLUDE_FILES = CreateExclusionTable() DTEXCLUDE_FILES.WriteXml(path_FileExclusions) End If DTEXCLUDE_FILES = GetTablefromXML() 'For Each Row As DataRow In DT.Rows ' rowresult &= Row.Item("FILE_CONTAIN") ' Select Case Row.Item("FILE_CONTAIN") ' End Select 'Next Return True Catch ex As Exception MsgBox("Error in ModuleUserSavings-LoadFileExclusion" & vbNewLine & ex.Message, MsgBoxStyle.Critical) Return False End Try Return True End Function Private Function CreateExclusionTable() As DataTable Try ' Create sample Customers table, in order ' to demonstrate the behavior of the DataTableReader. Dim table As New DataTable table.TableName = "TBEXCLUSION" ' Create two columns, ID and Name. table.Columns.Add("FILE_CONTAIN", GetType(System.String)) Dim newRow As DataRow = table.NewRow() newRow("FILE_CONTAIN") = "Thumbs" table.Rows.Add(newRow) Dim newRow1 As DataRow = table.NewRow() newRow1("FILE_CONTAIN") = "\~$" table.Rows.Add(newRow1) Dim newRow2 As DataRow = table.NewRow() newRow2("FILE_CONTAIN") = ".db" table.Rows.Add(newRow2) Dim newRow3 As DataRow = table.NewRow() newRow3("FILE_CONTAIN") = "desktop.ini" table.Rows.Add(newRow3) table.AcceptChanges() Return table Catch ex As Exception MsgBox("Error in CreateExclusionTable" & vbNewLine & ex.Message, MsgBoxStyle.Critical) Return Nothing End Try End Function Private Function GetTablefromXML() Try Dim DS As New DataSet DS.ReadXml(path_FileExclusions) Return DS.Tables(0) Catch ex As Exception MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message, MsgBoxStyle.Critical) Return Nothing End Try End Function End Module