我不明白为什么File.AppendAllText不能将新行保存到txt中。例如Textbox1.text包含:
Textbox1.text &= "hello, it's me, first lane" & Environment.NewLine
Textbox1.text &= "hello, it's me, second lane" & Environment.NewLine
和代码:
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
Dim saveFile1 As New SaveFileDialog()
saveFile1.DefaultExt = "*.txt"
saveFile1.Filter = "Text Files|*.txt"
' Determine if the user selected a file name from the saveFileDialog.
If (saveFile1.ShowDialog() = System.Windows.Forms.DialogResult.OK) _
And (saveFile1.FileName.Length) > 0 Then
' Save the contents of the TextBox into the file.
File.AppendAllText(saveFile1.FileName,
TextBox1.Text)
End If
End Sub
和文本框输出:
你好,是我,第一车道,是我,第二车道
我使用默认的记事本打开。如果使用写字板或Windows Office打开文件,则存在新行。那么如何使记事本看到新行