当前位置:编程学习 > C#/ASP.NET >>

VB.NET

VB.net开发智能设备时,怎么将数据写入.TXT文本中啊! 急求代码! --------------------编程问答-------------------- 给你一个函数吧 
    Public Sub savetxt(ByVal mystr As String, ByVal path As String)
        Dim s As Stream
        If Not File.Exists(path) Then
            s = File.Create(path)
            s.Close()
        End If
        Dim fs As FileStream = File.OpenWrite(path)
        Dim sw As New StreamWriter(fs)
        fs.Seek(0, SeekOrigin.End)
        sw.WriteLine(mystr)
        sw.Close()
        fs.Close()
    End Sub

其中mystr是要存的字符串,path是存储txt文件的路径

希望对你有用! --------------------编程问答-------------------- 智能设备不支持fileopen之类的函数啊
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,