Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 311073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:53:30+00:00 2026-05-12T07:53:30+00:00

I have a form with a richtextbox and a scrollbar. I want to be

  • 0

I have a form with a richtextbox and a scrollbar. I want to be able to keep appending text to the textbox without loosing my selection. I can save the selectionstart and selectionlength before I append the text and set it back and it works. The problem is when it comes to reverse selecting. The best I could do is set back the selectionstart at the right position but I have to move the mouse so it selects text again. I’m using the following functions before and after I append the text:

Private Sub StopRepaint()
Dim pt As Point
' Stop redrawing:
SendMessage(txtchat.Handle, WM_SETREDRAW, 0, pt)
' Stop sending of events:
eventmask = SendMessage(txtchat.Handle, EM_GETEVENTMASK, 0, pt)
End Sub

Private Sub StartRepaint()
Dim pt As Point
' turn on events
SendMessage(txtchat.Handle, EM_SETEVENTMASK, 0, pt)
' turn on redrawing
SendMessage(txtchat.Handle, WM_SETREDRAW, 1, pt)
' this forces a repaint, which for sotxtchat reason is necessary in sotxtchat cases.
txtchat.Invalidate()
End Sub

If my scrollbar position is not at complete bottom, i’m setting it back using this after the text is appended:

If Not isbottom(getpos) Then
    PostMessageA(txtchat.Handle, WM_VSCROLL, SB_THUMBPOSITION + _
                       &H10000 * getpos(), Nothing)
End If

My main goal is to be able to select and copy text even when new text is being appended to the richtextbox. Anyone knows how to correctly select text in reverse OR easily fix my problem about text being deselected? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:53:30+00:00Added an answer on May 12, 2026 at 7:53 am

    I would try making “selectable blocks” keep each appended slab of text independant of the next block. Sort of like MSN messenger. You can make the “panels” appear seamless and using a stringbuilder can export the final block safely as a single stream.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form with multiple input type=radio with text next to them. I want
I have a C# form. I want to write some explanations. I tried RichTextBox
I have a RichTextBox control on a form with some text, some of which
I have a RichTextBox on my form, and I want to use the default
How can I use RichTextBox Target in WPF application? I don't want to have
I have a form which has a RichTextBox docked to the left and DataGridView
I have a Windows Form with a RichTextBox on it. The content of the
I have form with few buttons and I want to know what button is
I have form where user submits field. Field can have letters, numbers, and punctuation.
I have form, where some fields are looks like rows, so I can add/delete

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.