Sorryif I'm a bit of a noob here, but can any one advise me on if/how it's possible to write to files using the MY object text field parser, or suggest another method of amending records in files using delimiters.
Below is how I read from the file:
Dim x As Integer
Dim AClass As String
Dim currentRow As String()
Dim rowlen As Integer
Using Myreader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser("SBDa ta_Class.dat")
Myreader.TextFieldType = FileIO.FieldType.Delimited
Myreader.SetDelimiters(",")
While Not Myreader.EndOfData
'pull out records and write to textbox
Try
currentRow = Myreader.ReadFields
rowlen = currentRow.Length
For x = 0 To rowlen - 1
AClass = currentRow(x)
textBox1.Items.Add(AClass)
Next
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineExceptio n
MsgBox("Line " & ex.Message & _
"is not valid and will be skipped.")
End Try
End While
End Using
Many thanks,
Phil