VB.net 控件richtextbox.text 输出txt文本中的内容不换行
问题如下,按下按钮1,将一段字符输入到richtextbox1.text,按下按钮2将richtextbox1.text的内容输出txt文件到本地磁盘,但是打开txt文件...
问题如下,按下按钮1,将一段字符输入到richtextbox1.text, 按下按钮2 将 richtextbox1.text的内容输出txt文件到本地磁盘,但是打开txt文件,里面是"123"
而在程序中的richtextbox1.text的显示内容是:
1
2
3
我写的代码如下:
'按钮1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
RichTextBox1.Text=“1”& vbCrLf & "2" & vbCrLf & "3"
End Sub
'按钮2
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim SaveFileDialog1 As New SaveFileDialog()
SaveFileDialog1.Filter = "txt files (*.txt)|*.txt"
If SaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, RichTextBox1.Text, False)
End If
End Sub 展开
而在程序中的richtextbox1.text的显示内容是:
1
2
3
我写的代码如下:
'按钮1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
RichTextBox1.Text=“1”& vbCrLf & "2" & vbCrLf & "3"
End Sub
'按钮2
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim SaveFileDialog1 As New SaveFileDialog()
SaveFileDialog1.Filter = "txt files (*.txt)|*.txt"
If SaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, RichTextBox1.Text, False)
End If
End Sub 展开
展开全部
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = "1" & vbCrLf & "2" & vbCrLf & "3"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim SaveFileDialog1 As New SaveFileDialog()
SaveFileDialog1.Filter = "txt files (*.txt)|*.txt"
If SaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
RichTextBox1.SaveFile(SaveFileDialog1.FileName, 3)
End If
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |