Okay, I've got it so that I can save and load rich text files using the savefile and openfile dialogs. The catch is that the extension has to be .rtf , and I'd like to be able to save it and load it as a different extension. My friend had made a program where he could save richtextfiles under a different extension, and load them in his program. I'm not quite sure how to do this. I'll give you my code:
For SaveFile Dialog:
Me.SaveFileDialog1.CheckPathExists = True
Me.SaveFileDialog1.OverwritePrompt = True
Me.SaveFileDialog1.Filter = "Text Document|*.rtf"
Me.SaveFileDialog1.ShowDialog()
Dim fs As System.IO.FileStream = CType _
(SaveFileDialog1.OpenFile(), System.IO.FileStream)
Select Case SaveFileDialog1.FilterIndex
Case 1
Me.RichTextBox1.SaveFile(fs, _
System.Windows.Forms.RichTextBoxStreamType.RichText)
End Select
For OpenFile Dialog:
Me.OpenFileDialog1.CheckPathExists = True
Me.OpenFileDialog1.CheckFileExists = True
Me.OpenFileDialog1.Filter = "Text Document|*.rtf"
Me.OpenFileDialog1.ShowDialog()
Dim fs As System.IO.FileStream = CType _
(OpenFileDialog1.OpenFile(), System.IO.FileStream)
Select Case SaveFileDialog1.FilterIndex
Case 1
Me.RichTextBox1.LoadFile(fs, _
System.Windows.Forms.RichTextBoxStreamType.RichText)
End Select