SaveFileDialog Question

G

Guest

Hi
I am using a SaveFileDialog with an RichTextBox. I am trying to save what
is in the RTB as file type html. All I end up with is garbage.

Dim saveFile1 As New SaveFileDialog
saveFile1.Filter = "Html Files (*.html)|*.html|RTF Files (*.rtf)|*.rtf |"
If (saveFile1.ShowDialog() = System.Windows.Forms.DialogResult.OK) _
And (saveFile1.FileName.Length) > 0 Then
RichTextBox1.SaveFile(saveFile1.FileName,
RichTextBoxStreamType.RichText)
End If

Any suggestions?

Thanks
BrianDH
 
P

Phill. W

BrianDH said:
I am using a SaveFileDialog with an RichTextBox.

First things first - the SaveFileDialog doesn't save anything.
It allows you to select the file *into* which something /else/ is going
to write something.
I am trying to save what is in the RTB as file type html.

Really? Didn't know the RTB could even do that ...
All I end up with is garbage.

And does this "garbage" happen to start with "\rtf" and have lots of
"\", "{" and "}" characters mixed in with it?
If so, that's not garbage; that's RTF!
RichTextBox1.SaveFile(saveFile1.FileName _
, RichTextBoxStreamType.RichText _
)

So that gets the RichTextBox control to "save" itself to a file,
presumably in the format specified in the second argument, which
you given as "RichText".
Are there any /other/ formats available for that second argument?

HTH,
Phill W.
 
D

Dragon

"BrianDH" <[email protected]> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ ×
ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
Hi
I am using a SaveFileDialog with an RichTextBox. I am trying to save what
is in the RTB as file type html. All I end up with is garbage.

It's not garbage, but text in Rich Text Format. RichTextBox does not
support saving in HTML format, so you probably have to implement this by
yourself.

Roman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top