Is there a built-in method to display line numbers in rich text box c# .net framework?

Muhammad Taha 21 Reputation points
2021-04-21T11:09:30.003+00:00

I am creating a text editor in windows form app c# .net framework. So, I want to display line numbers of Rich text box on left side. Is there a built-in control or function to do this?

Developer technologies Windows Forms
Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. AxD 671 Reputation points
    2021-04-21T12:14:35.157+00:00

    Unfortunately, no.

    That would be a feature too specialized for a control that's capable of displaying text in loads of fancy ways.

    In your case (with fixed line heights, I presume) you'd be required to add a second control aside the RichTextBox control to display the line numbers and keep its content in sync with the text displayed in the RichTextBox control.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. WayneAKing 4,931 Reputation points
    2021-04-21T12:12:34.653+00:00

    Have you read this thread?

    How to show number of a line in a RichTextBox C#
    https://stackoverflow.com/questions/2567263/how-to-show-number-of-a-line-in-a-richtextbox-c-sharp

    • Wayne
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.