streamreader.readline ,怎么只Read一个Line?但是不能【streamreader.readline(制定行数)】
- Imports System
- Imports System.IO
- Public Class ReadALine
- Private Sub ReadOneLine()
- Dim sr As New Streamreader("C:\Test.Txt")
- Dim textdata As String
- textdata = sr.ReadToEnd
- Dim line As String() = textdata.Split(vbCrLf)
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- For i As Integer = 0 To line.Count - 1
- If i = 5 Then'5 = 要读的行数
- textdata = line(i)
- End If
- Next
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- For i As Iteger = 0 To line.Count - 1
- If line(i).ToString.Contains("Text") Then
- textdata = line(i)
- End If
- Next
- End Sub
- End Class
看不懂在这里问~~




