Below is a sample of my text:
01"111111","2345678","7891090","M0000023"
02"111111","2345678","7891090","M0000023"
03"111111","2345678","7891090","M0000023"
01"111111","2345678",
"7891090","M0000023"
02"111111","2345678",7891090","M0000023"
03"111111","2345678",7891090","M0000023"
etc.
Sometime the input file has lines that wrapped and sometimes it does not. I need to read the text file line by line and then if the line does not begin with "01" or "02" or "03" join it to the line above it and write the fixed file to a new text file.
Imports System.IO
Public Class Form1
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim LineReader As StreamReader
Dim results As DialogResult
results = OpenFileDialog1.ShowDialog
If results = DialogResult.OK Then
LineReader = New StreamReader(OpenFileDialog1.FileName)
TextBox1.Text = LineReader.ReadLine()
LineReader.Close()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim FileWriter As StreamWriter
Dim results As DialogResult
results = SaveFileDialog1.ShowDialog
If results = DialogResult.OK Then
FileWriter = New StreamWriter(SaveFileDialog1.FileName, False)
FileWriter.Write(TextBox1.Text)
FileWriter.Close()
End If
End Sub
End Class
How can I do this with the code I have so far?
Thanks.