本文整理汇总了VB.NET中Microsoft.VisualBasic.FileIO.TextFieldParser类的典型用法代码示例。如果您正苦于以下问题:VB.NET TextFieldParser类的具体用法?VB.NET TextFieldParser怎么用?VB.NET TextFieldParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextFieldParser类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: TextFieldParser
Using MyReader As New Microsoft.VisualBasic.FileIO.
TextFieldParser("c:\logs\bigfile")
MyReader.TextFieldType =
Microsoft.VisualBasic.FileIO.FieldType.Delimited
MyReader.Delimiters = New String() {vbTab}
Dim currentRow As String()
'Loop through all of the fields in the file.
'If any lines are corrupt, report an error and continue parsing.
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
' Include code here to handle the row.
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message &
" is invalid. Skipping")
End Try
End While
End Using