Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim line As String = ""
Dim SR As New IO.StreamReader(TextBox2.Text)
Dim SB As System.Text.StringBuilder = New System.Text.StringBuilder
Do
line = SR.ReadLine
If line <> TextBox4.Text Then
SB.Append(line)
SB.Append(System.Environment.NewLine)
End If
Loop Until line = ""
SR.Close()
Dim SW As New IO.StreamWriter(TextBox2.Text, False)
SW.Write(SB.ToString())
SW.Close()
End Sub
Dim line As String = ""
Dim sr As System.IO.StreamReader = New System.IO.StreamReader("C:/text.txt")
Do
line = sr.ReadLine
If line <> TextBox2.Text Then
TextBox2.AppendText(line)
TextBox2.AppendText(System.Environment.NewLine)
End If
Loop Until line = ""
Iceplug said:How could you do what by writing to a file?
To write to a file, use StreamWriter instead of StreamReader.![]()
decrypt said:i just want to know how you can write text to a text file, simply...
Dim SW As New IO.StreamWriter("where to write")
SW.WriteLine("what to write") 'example: TextBox1.Text
SW.Close()