Question Displaying Text from Access data field in a TextBox - multiline with scroll.

Rollo

New member
Joined
Jun 26, 2011
Messages
2
Location
Cape Town, Western Cape, South Africa
Programming Experience
3-5
Hi
I am a self taught programmer and under VB6 I wrote a program which stores & displays data stored in access. I displayed the data in a text box using Multiline and scroll bars. Now that I wish to make some changes in the menu I had started to rewrite the program in .net but here is the problem. The text only displays on a single line in the text box even thought I have made the TextBox Multiline value = True. What do I do to display the text in a Multiline format in a text box/
Thanks in anticipation.
Rollo
 
Last edited by a moderator:
Please keep each thread to a single topic and each topic to a single thread. Duplicate thread deleted.

Setting Multiline to True means that the control interprets carriage return and line feed characters as line breaks, but if there are no carriage return and line feed characters in the text then there won't be multiple lines displayed. There are various ways to insert line breaks into a TextBox. The most basic is:
myTextBox.Text &= Environment.NewLine & "next line"
If you have multiple values from a database that you want to display then the best option would be to populate a String array with the data and then assign that to the Lines property.
 
There is multiple lines, and there is single lines wrapped to display on several lines. You need to set MultiLine to True either way, and then resize the controls height to allow it to display more than one line. When you have done this and assign a single line that is wider that the control it will wrap according to WordWrap property, which is True by default. Multiple lines separated by linefeeds will also then display properly.
 
Back
Top