您的位置:首页 > 编程语言 > VB

在vb.net使用System.IO读取文本文件

2009-09-17 10:05 387 查看
Imports System
Imports System.IO
Imports System.Collections

Module Module1

Sub Main()
Dim objReader As New StreamReader("c:\test.txt")
Dim sLine As String = ""
Dim arrText As New ArrayList()

Do
sLine = objReader.ReadLine()
If Not sLine Is Nothing Then
arrText.Add(sLine)
End If
Loop Until sLine Is Nothing
objReader.Close()

For Each sLine In arrText
Console.WriteLine(sLine)
Next
Console.ReadLine()
End Sub

End Module
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: