FileSystem.TAB 方法 (Int16)
配合 Print 或 PrintLine 函式用於定位輸出。
命名空間: Microsoft.VisualBasic
組件: Microsoft.VisualBasic (在 microsoft.visualbasic.dll 中)
語法
'宣告
Public Shared Function TAB ( _
Column As Short _
) As TabInfo
'用途
Dim Column As Short
Dim returnValue As TabInfo
returnValue = FileSystem.TAB(Column)
public static TabInfo TAB (
short Column
)
public:
static TabInfo TAB (
short Column
)
public static TabInfo TAB (
short Column
)
public static function TAB (
Column : short
) : TabInfo
參數
- Column
選擇項。在顯示或列印清單中的下一個運算式之前所要移至的欄位編號。如果省略,則 TAB 會將插入點移到下一個列印區的開頭。
傳回值
配合 Print 或 PrintLine 函式用於定位輸出。
備註
如需詳細資訊,請參閱 Visual Basic 的主題 TAB 函式。
如果目前所在行的目前列印位置大於 Column,則 TAB 會跳到等於下一個輸出行上 Column 的欄位值。如果 Column 小於 1,則 TAB 會將列印位置移到欄位 1。如果 Column 大於輸出行的寬度,則 TAB 會使用下列公式計算下一個列印位置:
欄位 Mod 寬度
例如,如果 width 是 80,且您指定 TAB(90),則下一個列印將從欄 10 (90/80 的餘數) 開始。如果 Column 小於目前的列印位置,則列印會在計算出來的列印位置上的下一行開始。如果計算出來的列印位置大於目前的列印位置,則列印會在相同一行的計算列印位置上開始。
輸出行上最左邊的列印位置一定是 1。當您使用 Print 或 PrintLine 函式列印到檔案時,最右邊的列印位置會是輸出檔的目前寬度,您可以使用 FileWidth 函式來設定此寬度。
TAB 函式也可以與 WriteLine 函式一起搭配使用,它不可與 System.Diagnostics.Debug.WriteLine 或 System.Console.WriteLine 搭配使用。
注意事項 |
---|
請確定您表格式資料行的寬度足以容納寬字母。 |
範例
此範例使用 TAB 函式將輸出定位於檔案中及 [輸出] 視窗內。
FileOpen(1, "TESTFILE", OpenMode.Output) ' Open file for output.
' The second word prints at column 20.
Print(1, "Hello", TAB(20), "World.")
' If the argument is omitted, cursor is moved to the next print zone.
Print(1, "Hello", TAB(), "World")
FileClose(1)
平台
Windows 98、 Windows 2000 SP4、 Windows Millennium Edition、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition
.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。
版本資訊
.NET Framework
支援版本:2.0、1.1、1.0
請參閱
參考
FileSystem 類別
FileSystem 成員
Microsoft.VisualBasic 命名空間
其他資源
TAB 函式
Mod 運算子 (Visual Basic)
Print、PrintLine 函式
Space 函式 (Visual Basic)
SPC 函式
FileWidth 函式