加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

VB.NET读写txt文件

(2018-11-05 09:13:42)
分类: VisualBasic.NET
        '写文件
        Dim mStreamWriter As New System.IO.StreamWriter(Application.StartupPath & "\1.txt")
        mStreamWriter.WriteLine("HelloWorld1")
        mStreamWriter.Close()
        '追加
        Dim mStreamWriter2 As New System.IO.StreamWriter(Application.StartupPath & "\1.txt", True)
        mStreamWriter2.WriteLine("HelloWorld3")
        mStreamWriter2.Close()
        '读文件
        Dim mStreamReader3 As New System.IO.StreamReader(Application.StartupPath & "\1.txt")
        Dim strLine As String
        Do While mStreamReader3.Peek > 0
            strLine = mStreamReader3.ReadLine
            MsgBox(strLine)
        Loop
        mStreamReader3.Close()

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有