在VS2013中,如何用VB创建txt文件

在VS2013中,如何用VB创建txt文件,第1张

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If Not IO.File.Exists("c:\123.txt") Then

            IO.File.CreateText("c:\123.txt")

        Else

            IO.File.WriteAllText("c:\123.txt", TextBox1.Text)

        End If

    End Sub

StreamReader sr = new StreamReader(txtPath.Text, Encoding.GetEncoding("GB2312"))

string line

string strShow = ""

while ((line = sr.ReadLine()) != null)

{

strShow = strShow + line + "\n"

}

rtxtRead.Text = strShow

sr.Close()


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11866573.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-19
下一篇2023-05-19

发表评论

登录后才能评论

评论列表(0条)

    保存