Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Strings::Space Method (Int32)

 

Returns a string consisting of the specified number of spaces.

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

public:
static String^ Space(
	int Number
)

Parameters

Number
Type: System::Int32

Required. Integer expression. The number of spaces you want in the string.

Return Value

Type: System::String^

Returns a string consisting of the specified number of spaces.

Exception Condition
ArgumentException

Number < 0.

The Space function is useful for formatting output and clearing data in fixed-length strings.

This example uses the Space function to return a string consisting of a specified number of spaces.

Dim TestString As String
' Returns a string with 10 spaces.
TestString = Space(10)
' Inserts 10 spaces between two strings.
TestString = "Hello" & Space(10) & "World"

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show:
© 2017 Microsoft