如果富体正文中有新行,如何创建新行? (正文是RichTextBox)
Dim a As New System.IO.StreamWriter("D:\ROBLOX Enquiries\" + FileName.Text + "\Info.txt")
a.Write(Body.Text & vbCrLf & "Date: " + DateValue(Now))
a.Close()
MsgBox("ENQUIRY CREATED", MsgBoxStyle.Information, "ENQUIRY CREATED")
Me.Close()
答案 0 :(得分:1)
当使用\n
字符的窗口时,RTB使用\r\n
字符显示新行。因此,您可以尝试用Windows标准新行字符替换RTB换行符来解决问题:
a.Write(Body.Text.Replace("\n", Environment.NewLine) & vbCrLf & "Date: " + DateValue(Now))