Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Imports System
Imports System.IO
Imports System.Collections
Imports System.Data
Imports System.Text
Public Sub ReadList(ByVal sDelimiter As String, ByVal sFilePath As String, ByVal sDataSetName As String, _
ByVal sNameSpace As String, ByVal sDataTableName As String, Optional ByVal sPrefix As String = "")
'Check to see if the demimited file exists
If Not System.IO.File.Exists(sFilePath) Then 'Doesnt exist
'Write to error log and let user know
oEvents.WriteToLog("Host Error list could not be found.", "", "ReadErrorList Error")
MsgBox("The Host Error List could not be found." & vbCrLf & _
"Please contact your software support", MsgBoxStyle.Critical)
Exit Sub
Else 'Delimited file exists
'Now check to see if the XML file already exists
If Not System.IO.File.Exists(Application.StartupPath & "\HostErrorList.xml") Then 'Doesnt exist
'Create the XML document from the delimited file
Try
dsErrorList.DataSetName = sDataSetName 'Set the DataSet name
dsErrorList.Namespace = sNameSpace 'Set the XML Document NameSpace
dsErrorList.Prefix = sPrefix 'Set the prefix (Optional)
dsErrorList.Tables.Add(sDataTableName) 'Add the table
'Read the delimited file
Dim srErrorList As New StreamReader(sFilePath)
'Go to the top of the file
srErrorList.BaseStream.Seek(0, SeekOrigin.Begin)
'Add in the Header Columns
For Each sFields In srErrorList.ReadLine().Split(sDelimiter) 'Loop through header list
dsErrorList.Tables(0).Columns.Add(sFields)
Next
'Now add in the Rows
dtErrorList = dsErrorList.Tables(0)
While (srErrorList.Peek() > -1) 'Loop while there are rows in the delimited file
drErrorList = dtErrorList.NewRow()
'Add the items to the DataSet
For Each sFields In srErrorList.ReadLine().Split(sDelimiter)
drErrorList(iCounter) = sFields
iCounter += 1
Next
iCounter = 0
'Add the new row to the DataSet
dtErrorList.Rows.Add(drErrorList)
End While
'Write the DataSet to an XML document
dsErrorList.WriteXml(Application.StartupPath & "\HostErrorList.xml")
Catch ex As Exception 'Delimited file doesnt exist
'Write to error file and let user know
oEvents.WriteToLog(ex.Message, ex.StackTrace, "ReadErrorList Error(Reading file)")
MsgBox("The host error list could not be read." & vbCrLf & _
"Please contact your software support", MsgBoxStyle.Critical)
Exit Sub
End Try
End If
End If
End Sub
oError.ReadList("!", Application.StartupPath & "\ErrorList.txt", "HostErrorList", "ErrorList", "ErrorDetails", "V1.0") [i]The names in the call are specific to my application, you will have your own.[/i]