I have a RichTextBox and I add some texts programatically. I need to display the data in “table format” like this:
product quantity price
The name of 1 1,00
a product
Second product 1 2,00
I am using selTabCount and selTabs, but the problem is with the text in the 1st column. When it is wide, it push the rest of the line to the right, like that:
product quantity price
The name of a product 1 1,00
Second product 1 2,00
I need to display the data with the first approach.
Actually, I want to wrap the description in a given column width. Is it possible?
Because you’re misusing the RichTextBox as a grid control, what you’re asking for is not natively supported. Your best bet is to use a proper grid control.
If you still want to use a RichText control, you’ll need to split the text itself using the control (or forms)
.TextWidth()method and calculate whether it’ll overflow. If it will, show only the bit that’ll fit and put the rest on the line after.This is more commonly done by keeping the description on one long line and moving doen the quantity values if it’s too long though.