473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SaveFileDialog Question

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
Nov 21 '05 #1
2 1220
"BrianDH" <Br*****@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
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.
Nov 21 '05 #2
"BrianDH" <Br*****@discussions.microsoft.com> сообщил/сообщила в
новостях следующее:
news:16**********************************@microsof t.com...
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
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ken Allen | last post by:
I have enocuntered something wierd. If I invoke an instance of the above dialog and elect to save the file in a directory where a file of that name does not exist, then the return is...
2
by: Yoshi | last post by:
Hi Everyone! I am using the SaveFileDialog class. I want the user to specify the "SaveAs" filename so I can use that name when creating a text document. Here is my question below. When the...
3
by: josh | last post by:
How do I make it actually save or open a file? It only opens the dialogs. What do I type to get it to save? Here's what I have so far: Public Class frmMainApp Inherits...
2
by: Amjad | last post by:
I'm writing a DLL code that has routines, one of which creates an Excel file and saves it, if certain conditions are met. I want the main project in the solution to call that routine in the DLL to...
17
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
3
by: =?Utf-8?B?UmljaA==?= | last post by:
I want to create a class library project (dll) for use with a com app. The idea is to use .Net objects in com. I also want to include a SaveFileDialog in the class library. Is it possible to...
2
by: jehugaleahsa | last post by:
Hello: Correct me if I'm wrong, but it appears that saving a file with the SaveFileDialog changes the Environment.CurrentDirectory property. How can I prevent this? Thanks, Travis
0
by: Ken Snyder | last post by:
hi, i have a situation here: i have a application with a form on which you can click on a button and it will open you a savedialog where you enter a path and save some filestream context to a...
8
by: Joe Duchtel | last post by:
Hello - I have the following code to detemine a file name when my application is saving a file. The problem is that if the file already exists and I select the Yes button in the "Do you want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.