jindalee
asked on
How do I programmatically add lines to a Rich Text Box
I have to read the contents of a number of text boxes andmaybe some list boxes (which could potentially hold a large number of items).
Having read them I have to add them to a Rich Text Box for output to a file or printer (or both).
I'm pretty new to Visual BAsic and have learned how to do things with RTBs like change fonts, styles and change the current text.
Can somone please advise me how I write multiple lines to a RTB, i.e. read the contents of a text box, insert it into the next line of a RTB, read the next text box, insert it etc.
(I know how to get the contents of the txt and list boxes, just not how to add them all to the RTB.
Having read them I have to add them to a Rich Text Box for output to a file or printer (or both).
I'm pretty new to Visual BAsic and have learned how to do things with RTBs like change fonts, styles and change the current text.
Can somone please advise me how I write multiple lines to a RTB, i.e. read the contents of a text box, insert it into the next line of a RTB, read the next text box, insert it etc.
(I know how to get the contents of the txt and list boxes, just not how to add them all to the RTB.
Also you can use Append method I am not sure whether it is with text or at object level
Yes, the AppendText method works the same as I posted. Either way, the ControlChars.NewLine constant is needed to add a new line.....
RichTextBox1.AppendText("Y our new text" & ControlChars.NewLine)
Wayne
RichTextBox1.AppendText("Y
Wayne
No I suppose append don't require newline.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
RichTextBox1.Text &= "Your new text" & ControlChars.NewLine
Wayne