Link to home
Start Free TrialLog in
Avatar of dmfolsom
dmfolsom

asked on

RichTextBox is running my computer out of Memory

OS: Windows 2000 and Windows XP
VB5 Service Pack 3

I have an application that loads a Rich Text Box with a .Rtf file every ten seconds.
rtbWelcome.LoadFile fileWelcome_Docs.Path + "\" + fileWelcome_Docs.List(MyCounter), rtfRTF
These files were created in Word then converted to Richtext format to be displayed in the RichText Box.
These files contains Text, Inserted Pictures and other Graphics.

After displaying the RTB for ten seconds, it is cleared using rtbWelcome.TextRTF = ""
The memory used by the RTB is partially cleared, however the majority is not. When the application loads the next file the memory used by the application is increased until the point the the computer runs out of resources and crashes.

How do I recover all memory each time I unload the file?
Would there be a better format to display these files to computers that don't have word installed?
ASKER CERTIFIED SOLUTION
Avatar of hes
hes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That or try setting both text properties to ""
rtbWelcome.TextRTF = ""
rtbWelcome.Text = ""
Avatar of dmfolsom
dmfolsom

ASKER

Thanks for the response!

I use the second option befor each load:
rtbWelcome.TextRTF = ""
rtbWelcome.Text = ""
rtbWelcome.LoadFile fileWelcome_Docs.Path + "\" + fileWelcome_Docs.List(Saf), rtfRTF
Thanks for the response!

I use the second option before each load:
rtbWelcome.TextRTF = ""
rtbWelcome.Text = ""
rtbWelcome.LoadFile fileWelcome_Docs.Path + "\" + fileWelcome_Docs.List(Saf), rtfRTF

Still incrementing up the memory used.  Any other suggestions?
Did youtry the first example where you save off an empty rtf then copy that into the rtf
I really appreciate you involvement!

I tried it this way first:
'rtbWelcome.TextRTF = ""
'rtbWelcome.Text = ""
rtbWelcome.TextRTF = strRTB

Then switched to this:

rtbWelcome.TextRTF = ""
rtbWelcome.Text = ""
rtbWelcome.TextRTF = strRTB

Still incrementing the memory.