RichTextBox lockup

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tcloud

    #1

    RichTextBox lockup

    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.ToSt ring()

    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.ScrollBar s = RichTextBoxScro llBars.Both

    That works okay, but I'd like to lose the RichTextBoxScro llBars.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.
Working...