streamwriter_object.WriteLine Method

Writes a number or a String to an output device or file, followed by the NewLine line terminator.

steamwriter_object.WriteLine( number )
-or-
steamwriter_object.WriteLine( string_value )

Prerequisites

The output stream must have been opened using a New to create the streamwriter_object.

Parameters

number

A numeric value that is converted to a String and written.

string_value

A String expression this is written. Each byte of the String may be an arbitrary 8-bit value.

Remarks

This method is the same as the Write method with the addition that it appends the value of the NewLine property to any output requests.

This method writes String data to an output device or file. If a number is passed as the argument, it is first converted to an ASCII String value and then output.

Buffering of data is determined by the setting of the AutoFlush property. When output is actually performed, this method blocks until it is complete.

If any I/O error occurs, this method throws an Exception.

Examples

Dim tfile As New StreamWriter("/ROMDISK/test.tmp")
tfile.WriteLine("Test") ' Writes "Test"
tfile.WriteLine(3.14) ' Writes "3.14" on the line following "Test"

See Also

File and Serial I/O | streamwriter_object.NewLine | streamwriter_object.Write