Invalid Format Error when Opening/Saving in Visual Studio 2008.

5 pts.
Tags:
RichTextBox
Software development
VB
Visual Basic
Visual Basic 2008
Visual Studio
Visual Studio 2008
Hi I'm creating a professional Text Editor with usage of RichTextBox control, and I have inserted some common controls such as SaveFileDialog and Load File Dialolg, and I basically want to be able to load files of all types (i.e Word Documents) the only documents I can open are RTF. I tried to manipulate .Filter property, but that didn't work out well. Here I insert example event-handler of the open file procedure; Private Sub Open1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripButton.Click 'Activate code in procedure depending on the value returned from DiscardChanges Function. If DiscardChanges() Then 'Assigning Filters for the Control OpenFileDialog1.Filter = "RTF Files|*.RTF|Documents|*.DOC|All Files|*.*" 'Assigning Default extension for the controller. OpenFileDialog1.DefaultExt = "RTF" 'Opening Control If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then 'Assigning users filepath to the Fname veriable Fname = OpenFileDialog1.FileName 'Using That veriable in Load File method Editor.LoadFile(Fname, RichTextBoxStreamType.TextTextOleObjs) End If End Sub -----------------------------------------------------------------------------------------

Answer Wiki

Thanks. We'll let you know when a new response is added.

Each document type requires it’s own unique interpreter in order to read files. For example, Microsoft Word documents are stored as a binary file. When you open the file in Word, the interpreter built into Word knows how to translate the binary into the formatted text you see in Word. Rich Text is more of an open format used for document interchange between different word processing programs and the RTF control knows how to interpret RTF files.
Obviously it is possible to write your own Word interpreter since other software vendors have word processors that can open Word documents but I can only imagine how much work it would be to code your own solution. You may have better luck with the new Open Office XML format.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following