首页 > 编程 > .NET > 正文

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

2024-07-10 13:04:16
字体:
来源:转载
供稿:网友
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
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表