将文本框的内容发送到记事本文档VB.NET
我正在创建一个程序,当我的跑步者在文本框中输入他们的时间时,它会立即将其导出到他们桌面上名为times.txt的文件(预先创建的)。每次他们输入时间时,我希望他们输入的时间被添加到记事本文件的新行中 以下是我目前掌握的代码:将文本框的内容发送到记事本文档VB.NET,vb.net,textbox,notepad,Vb.net,Textbox,Notepad,我正在创建一个程序,当我的跑步者在文本框中输入他们的时间时,它会立即将其导出到他们桌面上名为times.txt的文件(预先创建的)。每次他们输入时间时,我希望他们输入的时间被添加到记事本文件的新行中 以下是我目前掌握的代码: Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Ha
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
End Sub
End Class
有人能给我这个需要的代码吗?你可以这样使用:
Dim desktopPath As String =
Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim fileName As String = "times.txt"
Dim fullPath As String = IO.Path.Combine(desktopPath, fileName)
IO.File.AppendAllLines(fullPath, {"Some new line in the file"})
获取用户桌面文件夹路径的其他方法:
StreamReader
和StreamWriter
类。如何使{“文件中的某些新行”}更改为在tex框中输入的内容@Neolisk@user3448601:替换为{textbox1.Text}