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


詳細については、Visual Basic のトピック「TextFieldParser.EndOfData プロパティ」を参照してください。
このプロパティを使用すると、ファイルを読み込む際、処理対象となるデータの終端を判断できます。
EndOfData プロパティを使ったタスクの例を次の表に示します。

この例では、TextFieldReader (FileReader) の EndofData プロパティを使用して、ファイル内のすべてのフィールドをループ処理しています。
Dim StdFormat As Integer() = {5, 10, 11, -1} Dim ErrorFormat As Integer() = {5, 5, -1} Using FileReader As New _ Microsoft.VisualBasic.FileIO.TextFieldParser("C:\testfile.txt") FileReader.TextFieldType = FileIO.FieldType.FixedWidth FileReader.FieldWidths = StdFormat Dim CurrentRow As String() While Not FileReader.EndOfData Try Dim RowType As String = FileReader.PeekChars(3) If String.Compare(RowType, "Err") = 0 Then ' If this line describes an error, the format of the row will be different. FileReader.SetFieldWidths(ErrorFormat) CurrentRow = FileReader.ReadFields FileReader.SetFieldWidths(StdFormat) Else ' Otherwise parse the fields normally CurrentRow = FileReader.ReadFields For Each newString As String In CurrentRow My.Computer.FileSystem.WriteAllText("newFile.txt", newString, True) Next End If Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException MsgBox("Line " & ex.Message & " is invalid. Skipping") 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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTextFieldParser.EndOfData プロパティを検索する場合は、下記のリンクをクリックしてください。

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