FileSystem.SPC Method

Used with the Print or PrintLine function to position output.

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

public static SpcInfo SPC(
	short Count


Type: System.Int16

Required. The number of spaces to insert before displaying or printing the next expression in a list.

Return Value

Type: Microsoft.VisualBasic.SpcInfo
Used with the Print or PrintLine function to position output.

If Count is less than the output line width, the next print position immediately follows the number of spaces printed. If Count is greater than the output line width, SPC calculates the next print position using the formula:

currentprintposition(+(Count Mod width))

For example, if the current print position is 24, the output line width is 80, and you specify SPC(90), the next print will start at position 34 (current print position + the remainder of 90/80). If the difference between the current print position and the output line width is less than Count (or Count Mod width), the SPC function skips to the start of the next line and generates spaces equal to Count – (widthcurrentprintposition).


Make sure your tabular columns are wide enough to allow for wide letters.

This example uses the SPC function to position output in a file and in the Output window.

' The SPC function can be used with the Print function.
FileOpen(1, "TESTFILE", OpenMode.Output)   ' Open file for output.
Print(1, "10 spaces between here", SPC(10), "and here.")
FileClose(1)   ' Close file.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft