473,748 Members | 4,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

richtextbox loadfile problem

I am trying to spell check a richtextbox. Through code (shown below) I
save the contents of the richtextbox to a rtf file, open the rtf file
in Word, spell check it, save it, and then load the ftf file back into
the ricktextbox using loadfile.

The problem is that the richtextbox seems to remain bound to the rtf
file. If I make a change in the richtextbox after spell checking, the
changes are successfully saved to the database but if the richtextbox
is refreshed, the text from the rtf file is reloaded into the
richtextbox. I have confirmed this by completeing the spell check,
making changes directly in the richtextbox and saving the record,
viewing the saved record from another PC, editing the saved rtf file
that I loaded into the richtextbox while my form with the richtextbox
is open. When I do all that, the changes I made directly in the
richtextbox disappear and the text I edited in Word appear.

I hope I am missing something really obvious. Any help would be
appreciated.

Private Sub Command259_Clic k()

Dim oWord As Object

Set oWord = CreateObject("W ord.Application ")

'Save the RTF Box contents to a temporary file
Me.SUMMARY.Save File "r:\letters\spe ller.RTF", rtfRTF

'Open the saved document and spellcheck it
oWord.Documents .Open ("r:\letters\sp eller.RTF")
oWord.ActiveDoc ument.SpellingC hecked = False
oWord.Options.I gnoreUppercase = False
oWord.ActiveDoc ument.CheckSpel ling

'Save the changes to the RTF file & close
oWord.ActiveDoc ument.Save
oWord.ActiveDoc ument.Close
oWord.Quit

'Load the changes back to the rtf text box.
Me.SUMMARY.Load File "r:\letters\spe ller.RTF", rtfRTF

Set oWord = Nothing

MsgBox "Spell Check is complete", _
vbInformation, "Spell Check"
Exit Sub

SpellCheckErr:
MsgBox Err.Description , vbCritical, _
"Spell Check"
Set oWord = Nothing

Nov 13 '05 #1
0 3246

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

Similar topics

1
6550
by: Yuelin | last post by:
Hi there How can I read a RTF file into a RichTextBox control without the original format being lost? And how can I save the text entered in a RichTextBox into a RTF file without the original format being lost? It seems I can't use System.IO.StreamReader. Is there any thing I can use to do this? Many thanks
1
2007
by: Yuelin | last post by:
Hi, thanks Noah for your advice. I wrote following to read a rich text file into a RichTextBox control: this.m_textBox.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.RichText); I created a RTF file in Word, and gave the background yellow. But when open
1
2495
by: Nathan Carroll | last post by:
In an mdi environment I constructed a child for with a richtextbox control that is used to load .rtf's. This works fine on the intiatial load of the form but when for is closed and reopened later I get: System.ObjectDisposedException: Cannot access a disposed object named "RichTextBox". Object name: "RichTextBox". at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.TextBoxBase.CreateHandle() at...
0
2112
by: y2k692hu | last post by:
Hello I am trying to run this and I keep getting a "SystemNullReferenceException: Object reference not set to instance of an object" error. I have three menu items bold, italic and underline. When i select the text in my RichTextBox, in order to format it bold, italic or underline, I get that error. The debugger points to my Private Sub UpdateMenuItems - the first line of that sub ->where it says "If rtbMain.SelectionFont.Italic = True ".I want...
0
2650
by: OmniTech via .NET 247 | last post by:
I am having trouble updating lines in a richtextbox. The rtb.lines.setvalue("text", linenumber) runs, but does not update the control in the form. The code follows... This apps automatically updates an output screen with changes in the file when the file length changes.. Private Sub LoadFile() Dim lineCount As Integer = 0 Dim line As String Dim iLength As Integer If File.Exists(gFile) Then Dim fs As New FileStream(gFile,...
1
1682
by: tulasi | last post by:
I am placing textbox controls and combo box controls on richtext box and 2 command buttons on form control. after executing the application i'll place some text into textbox controls and select a value from combo box after entering of all the details i'll click on one of the command buttons then it will save the contents of the controls which i placed on the richtextbox into a file then i'll click on another command button so it will...
0
2389
by: AxOn | last post by:
Hi! I'm having trouble creating a save funktion. How can I save the contens of a new richTextBox that is created from an "external" class file? The open funktion looks like this: public void openFile() { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = "Select a Text File";
0
2886
by: bettiahamit | last post by:
here i created sequence no. with every paragraph line .. like... <p local_id = P-100>aaaaaaaaaaaaaaaaaaaaaaaaa<\p> <p local_id = P-101>bbbbbbbbbbbbbbbbbbbbbbbbb<\p> <p local_id = P-102>vvvvvvvvvvvvvvvv<\p>
3
1273
Shinobi
by: Shinobi | last post by:
c#.net I have 2 forms. richtextbox1 is placed in form1. listbox1 is used in form2. selectedindex of listbox1 is passing path to form1. by using this path i am trying to load richtextbox1 using this code richtextbox1.loadFile(filepath); But i can't load richtextbox without closing form2. I tried this meathod.
0
8984
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9530
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9363
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.