if you have a lot of such calls. Better to use StringBuilder:
Dim sb as StringBuilder = New StringBuilder()
sb.AppendLine("This is the first line")
sb.AppendLine("This is the second line")
sb.AppendLine("This is the third line")
....
' Just one call to IO subsystem
File.AppendAllText("c:\mytextfile.text", sb.ToString())
If you really have many lines to write, you can wrap everything in a method.
Private Sub AddTextLine(ByVal sb As StringBuilder, ByVal line as String)
sb.AppendLine(line)
If sb.Length > 100000 then
File.AppendAllText("c:\mytextfile.text", sb.ToString())
sb.Length = 0
End If
End Sub
Steve source
share