FileSystem.FileWidth Method (Int32, Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Assigns an output line width to a file opened by using the FileOpen function.

Namespace:   Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static void FileWidth(
	int FileNumber,
	int RecordWidth


Type: System.Int32

Required. Any valid file number.

Type: System.Int32

Required. Numeric expression in the range 0–255, inclusive, which indicates how many characters appear on a line before a new line is started. If RecordWidth equals 0, there is no limit to the length of a line. The default value for RecordWidth is 0.

Exception Condition

FileNumber does not exist.


File mode is invalid.

This example uses the FileWidth function to set the output line width for a file.

Dim i As Integer
FileOpen(1, "TESTFILE", OpenMode.Output) ' Open file for output.
FileWidth(1, 5)   ' Set output line width to 5.
For i = 0 To 9   ' Loop 10 times.
    Print(1, Chr(48 + I))   ' Prints five characters per line.
FileClose(1)   ' Close file.

.NET Framework
Available since 1.1
Return to top