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 8030707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:51:21+00:00 2026-06-05T00:51:21+00:00

Ok i found a strange type of bug in MS default Richtextbox in vb.net

  • 0

Ok i found a strange type of bug in MS default Richtextbox in vb.net 2008. If we add some line of text in Richtextbox programmaticlly. there is a gape from right side. see the image below

ٰerror

here is my code

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim f As New Form
    Dim rtb As New RichTextBox
    f.Width = 500
    f.Height = 500
    rtb.RightToLeft = Windows.Forms.RightToLeft.Yes
    For i = 1 To 20
        rtb.AppendText("بسم اللہ الرحمن الرحیم" & vbNewLine)
    Next
    rtb.Dock = DockStyle.Fill
    f.Controls.Add(rtb)
    f.Show()
End Sub
  • 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-06-05T00:51:22+00:00Added an answer on June 5, 2026 at 12:51 am

    I can’t explain it, but try changing the order of your code so that the RichTextBox control is added to the form before you append the text. This worked for me:

    Private Sub btn1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn1.Click
      Dim f As New Form
      f.Width = 500
      f.Height = 500
    
      Dim rtb As New RichTextBox
      rtb.Name = "rtb"
      rtb.Dock = DockStyle.Fill
      rtb.RightToLeft = RightToLeft.Yes
    
      f.Controls.Add(rtb)
      For i = 1 To 25
        rtb.AppendText("بسم اللہ الرحمن الرحیم" & vbNewLine)
      Next
      f.Show()
    
      f.BeginInvoke(New Action(Of RichTextBox)(AddressOf RunFix), rtb)
    End Sub
    
    Sub RunFix(ByVal rtfControl As RichTextBox)
      rtfControl.Select(0, 0)
      rtfControl.ScrollToCaret()
    End Sub
    

    I added a hack BeginInvoke method that performs a ScrollToCaret() call which seems to fix the problem.

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

Sidebar

Related Questions

I just found some strange behavior of database's order by clause. In string comparison,
I found a strange problem when I used class Generics Today: Setting some broke
I found strange bug (maybe). When I send parameters to $.ajax in a form
Debugging some finance-related SQL code found a strange issue with numeric(24,8) mathematics precision. Running
I found strange generics behaviour. In two words - thing I realy want is
I am using celltable -- gwt2.3. I found strange behavior in celltable. My celltable's
I to try create my first javascript app with backbone.js And I found strange
Found very strange behavior of MS Access database when running queries from c#. It
I found this strange JavaScript I cannot understand. The for cycle has a strange
I found a strange ToolStripButton double click problem. These steps will reproduce the problem:

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.