I have a Multiline richtextbox control into which i want to integrate the feature of adding a line number. i have considered many approaches
- Add a label and updating the line numbers as the line count changes
- Add a picturebox along with to draw string on it.
- Add another textbox along with and show line numbers on it
- Add listbox along and display line numbers in it.
I got two doubts.
- The richtextbox which i'm using is a custom made control and derieves from RichTextBox class. How can i add multiple controls to it.
- What is the best approach to show line numbers for the multiline text in c#
My own example. All is fine, but wordwrap must be disabled :(
where rTB is my richtextbox and tB is textBox next to rTB
J.T. jr
this code helped me thank you, needed to convert visual basic but could:
WORKS 100%!!! But you need to add richTextBox2 for line numbers, if you want change it to other form like listbox, anyway it served me well.