K
kronecker
I am trying to delete multiple lines in a text file using the
following
Private Sub Read_TextFile()
Dim objReader As StreamReader
Dim strfull, strContents, strContentsold, strContentsnew As
String
objReader = New StreamReader("C:\answer.txt")
'Clear the Text Box1
TextBox1.Clear()
strContentsold = ""
strContentsnew = ""
strContents = ""
strfull = ""
Do While Not objReader.EndOfStream
strContentsold = strContentsnew
strContentsnew = objReader.ReadLine
If strContentsnew = strContentsold Then
strContents = ""
Else
strContents = strContentsnew
End If
strfull += strContents
Loop
TextBox1.Text = strfull
objReader.Close()
End Sub
The text will be stored in TextBox1.
However, it appears not to work! I was wondering if anybody had any
ideas. Here is tan original text file as an example
I assume that you wanted to know whether I can tell you about Wales.
I assume that you wanted to know whether I can tell you about Wales.
whether I can tell you about Wales
Wales is an administrative division in the UK.
Wales
an administrative division
the UK
Source: START KB
Source:
Go back to the START dialog window.
Go back to the START dialog window.
Go back to the START dialog window.
following
Private Sub Read_TextFile()
Dim objReader As StreamReader
Dim strfull, strContents, strContentsold, strContentsnew As
String
objReader = New StreamReader("C:\answer.txt")
'Clear the Text Box1
TextBox1.Clear()
strContentsold = ""
strContentsnew = ""
strContents = ""
strfull = ""
Do While Not objReader.EndOfStream
strContentsold = strContentsnew
strContentsnew = objReader.ReadLine
If strContentsnew = strContentsold Then
strContents = ""
Else
strContents = strContentsnew
End If
strfull += strContents
Loop
TextBox1.Text = strfull
objReader.Close()
End Sub
The text will be stored in TextBox1.
However, it appears not to work! I was wondering if anybody had any
ideas. Here is tan original text file as an example
I assume that you wanted to know whether I can tell you about Wales.
I assume that you wanted to know whether I can tell you about Wales.
whether I can tell you about Wales
Wales is an administrative division in the UK.
Wales
an administrative division
the UK
Source: START KB
Source:
Go back to the START dialog window.
Go back to the START dialog window.
Go back to the START dialog window.