Stream writer Flush

MTSkull

Well-known member
Joined
Mar 25, 2003
Messages
135
Location
Boulder, Colorado
Do I need to flush the stream writer after a write line?

Code:
Dim dsLocal As New DataSet
Dim drLocal As DataRow
Dim path As String
Dim sw As StreamWriter
Dim x As Int16

Fill Dataset and Rows Here

path = System.Windows.Forms.Application.StartupPath & "\ExportToVendor.txt"

if the file does not exsist then make a new one
If File.Exists(path) = False Then
  sw = File.CreateText(path)
  sw.Close()
End If
sw = File.AppendText(path)

For x = 0 To dsLocal.Tables(TEMP_TABLE).Rows.Count - 1
  drLocal = dsLocal.Tables(TEMP_TABLE).Rows(x)
  sw.WriteLine(drLocal("MyValue").toString)
  sw.Flush()
Next x

sw.Close()

More Stuff Here
 
Back
Top