TextFieldParser.FieldWidths プロパティ
アセンブリ: Microsoft.VisualBasic (microsoft.visualbasic.dll 内)

Dim instance As TextFieldParser Dim value As Integer() value = instance.FieldWidths instance.FieldWidths = value
/** @property */ public int[] get_FieldWidths () /** @property */ public void set_FieldWidths (int[] value)
Integer ().

詳細については、Visual Basic のトピック「TextFieldParser.FieldWidths プロパティ」を参照してください。
このプロパティは、TextFieldParser.TextFieldType プロパティ = FieldType.FixedWidth の場合にのみ有効です。配列の最後のエントリがゼロ以下であった場合、そのフィールドは可変長であると見なされます。
SetFieldWidths メソッドを使用してフィールドの幅を設定することもできます。詳細については、「TextFieldParser.SetFieldWidths メソッド」を参照してください。
FieldWidths プロパティを使ったタスクの例を次の表に示します。

この例では、列幅を指定して、ファイル ParserText.txt を読み込みます。1 列目を 5 文字、2 列目を 10 文字、3 列目を 11 文字とし、4 列目は可変長としています。
Using MyReader As New _ Microsoft.VisualBasic.FileIO.TextFieldParser("C:\ParserText.txt") MyReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.FixedWidth MyReader.FieldWidths = New Integer() {5, 10, 11, -1} Dim currentRow As String() While Not MyReader.EndOfData Try currentRow = MyReader.ReadFields() Dim currentField As String For Each currentField In currentRow MsgBox(currentField) Next Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException MsgBox("Line " & ex.Message & _ "is not valid and will be skipped.") End Try End While End Using

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TextFieldParser クラス
TextFieldParser メンバ
Microsoft.VisualBasic.FileIO 名前空間
TextFieldParser.FieldWidths プロパティ
その他の技術情報
TextFieldParser.FieldWidths プロパティ
TextFieldParser オブジェクト
方法 : Visual Basic で固定幅のテキスト ファイルを読み取る
FieldType 列挙型
方法 : Visual Basic でコンマ区切りのテキスト ファイルを読み取る
方法 : Visual Basic で複数の書式を持つテキスト ファイルを読み取る
TextFieldParser オブジェクトによるテキスト ファイルの解析
例外のトラブルシューティング : Microsoft.VisualBasic.FileIO.TextFieldParser.MalformedLineException
Weblioに収録されているすべての辞書からTextFieldParser.FieldWidths プロパティを検索する場合は、下記のリンクをクリックしてください。

- TextFieldParser.FieldWidths プロパティのページへのリンク