Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
Spc Function
This standard VB function prints a specified number of spaces.
Syntax
Spc(number)
Argument Description number An integer or integer expression indicating the number of spaces to print
Returns
A string of spaces in the target of a Print statement.
Usage
The Spc function can be used only inside a Print statement.
When the Print statement is used, the Spc function uses the following rules for determining the number of spaces to output:
- If number is less than the total line width, Spc outputs number spaces.
- If number is greater than the total line width, Spc outputs number Mod width spaces.
- If the difference between the current print position and the output line width (call this difference x) is less than number or number Mod width, then Spc skips to the next line and outputs number - x spaces.
To set the width of a print line, use the Width statement.
Example
This example outputs five spaces and the string
ABCD
to a file. The five spaces are derived by taking 15 Mod 10, or the remainder of dividing 15 by 10.Sub Button_Click
Dim str1 as String
Dim x as String * 10
str1 = "ABCD"
Open "C:\temp001" For Output As #1
Width #1, 10
Print #1, Spc(15); str1
Close #1
Open "C:\TEMP001" as #1 Len = 12
Get #1, 1,x
Close #1
Kill "C:\temp001"
End SubSee Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |