Immediately writes any buffered data for a StreamWriter Object.
steamwriter_object.Flush
Prerequisites
The output stream must have been opened using a New to create the streamwriter_object.
Parameters
None
Remarks
This method immediately writes any buffered data to the output device or file. When output is performed, this method blocks until it is complete. Calling the Flush method is redundant if the AutoFlush property is set to True. Explicit flush operations are more efficient than setting AutoFlush to True if you are performing a number of small write requests. If AutoFlush is True, each small write request causes output to occur. If AutoFlush is False, the small write requests can be buffered and the entire buffer is written by a single Flush. A Flush equivalent is always performed by the Close method. If any I/O error occurs, this method throws an Exception.
Examples
Dim com As New StreamWriter("/dev/com1")
com.AutoFlush = False ' Disable automatic flush
com.Write("Write")
com.Write(" a short ")
com.WriteLine("message")
com.Flush
See Also