原帖由 goodhermit95 于 2008-11-1 11:37 PM 发表
streamreader.readtoend
streamreader.readline ,怎么只Read一个Line?但是不能【streamreader.readline(制定行数)】
[Copy to clipboard] [ - ]CODE:
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
看不懂在这里问~~
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
欢迎光临 JBTALKS.CC (https://jbtalks.my/) | Powered by Discuz! X2.5 |