Click here to Skip to main content
15,907,395 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hi !!

How to save line by line of String from RichTextBox to Another file which can select from saveDialogBox......

As a Example
I wrote this in MY Richtext Box
"AAAAAAAAAAAAAAAAABBBBB
CCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDD
EEEEEEEEEEE"

It should save in txt file or etc..
as i entered into RichTextBox
:confused:
Thanx
Posted
Comments
William Winner 28-Jun-10 13:16pm    
Reason for my vote of 1
learn to use google...it's your friend!
Kschuler 28-Jun-10 13:28pm    
Reason for my vote of 3
I thought you getting 1-ed was a little harsh. At least your question was clear, even if you didn't google first.
Hashan001 29-Jun-10 0:03am    
Thanks alot...

Try google next time. I very quickly found this link[^] which has some great sample code.
 
Share this answer
 
Comments
Hashan001 29-Jun-10 0:49am    
Thanks alot... I was google but i couldn't find this.....
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
    With diaSave
        .Filter = "Text File(*.txt)|*.txt|WordPad File(*.rtf)|*.rtf"
        .OverwritePrompt = True
        If .ShowDialog = Windows.Forms.DialogResult.OK Then
            If .FilterIndex = 1 Then
                richTxt.SaveFile(.FileName, RichTextBoxStreamType.PlainText)
            ElseIf .FilterIndex = 2 Then
                richTxt.SaveFile(.FileName, RichTextBoxStreamType.RichText)
            End If
        End If
    End With
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900