TextFieldParser.LineNumber 속성

업데이트: 2007년 11월

스트림에서 문자를 더 이상 사용할 수 없는 경우 현재 줄 번호 또는 -1을 반환합니다.

' Usage
Dim value As Long = TextFieldParserObject.LineNumber
' Declaration
Public ReadOnly Property LineNumber As Long

반환 값

Integer.

설명

이것은 고급 멤버이며 모두 탭을 선택하지 않으면 IntelliSense에서 표시되지 않습니다.

줄 번호를 확인할 때 빈 줄 및 주석은 무시되지 않습니다.

예제

이 예제에서는 텍스트 파일에서 "Jones"라는 이름을 검색하고 어떤 줄에서 발생하는지 보고합니다.

Using FileReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\ParserText.txt")
    FileReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited
    FileReader.Delimiters = New String() {","}
    Dim currentRow As String()
    While Not FileReader.EndOfData
        Try
            currentRow = FileReader.ReadFields()
            Dim currentField As String
            For Each currentField In currentRow
                If currentField = "Jones" Then
                    MsgBox("The name Jones occurs on line " & _
                    FileReader.LineNumber)
                End If
            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

요구 사항

네임스페이스:Microsoft.VisualBasic.FileIO

클래스:TextFieldParser

어셈블리: Visual Basic 런타임 라이브러리(Microsoft.VisualBasic.dll)

권한

사용 권한이 필요하지 않습니다.

참고 항목

참조

TextFieldParser 개체

TextFieldParser.LineNumber