By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,698 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,698 IT Pros & Developers. It's quick & easy.

RichTextBox lockup

P: n/a
I have a RichTextBox that:
- 1st would intermittently show the scroll bars but they wouldn't work
- 2nd now doesn't allow any interaction even though it looks normal

The application processes pure text files up to 20 MB. The data is
processed and summed into StringBuilder and then placed into the RichTextBox
using:
-- rtxt1.Text = strBuilder.ToString()

The RichTextBox is initially set up on the form as:
-- DetectUrls = False
-- Enabled = False
-- ReadOnly = True
-- ScrollBars = Both
-- WordWrap = False

The only values that needed to be changed (I thought) were Enabled and
ReadOnly, which were to be toggled between True and False.

During processing, the RichText Box is disabled:
-- rtxt1.Enabled = False
-- rtxt1.ReadOnly = True

After processing, the RichText box is re-enabled to allow for manual
tweaking of the data.
-- rtxt1.Enabled = True
-- rtxt1.ReadOnly = False

That seemed to work for small files, but the problem of the non-functioning
scroll bars appeared when a mix of small and large files were processed -- it
seemed to get "confused".

.... this is what finally worked to make the RichText box to work reliably:
-- rtxt1.Enabled = True
-- rtxt1.ReadOnly = False
-- rtxt1.Visible = True
-- rtxt1.ScrollBars = RichTextBoxScrollBars.Both

That works okay, but I'd like to lose the RichTextBoxScrollBars.Both
statement because it exactly doubles my processing time -- 12 seconds for
that statement alone on 20 MB data in the RichTextBox.

However, removing the ScrollBars statement now causes a text box that looks
normal but doesn't allow any interaction with it.

Any help appreciated for whatever it is I'm overlooking.
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.