For example,
In VB 6.0 - Object Browser
If we click on any Classes or Members down side it will show multi line text.
How can i do that?

Dani AI

Generated

Short practical summary: the behavior you saw in the VB6 Object Browser is just a Text control showing a string that contains line breaks. As pointed out, supply the text with embedded line breaks and make sure the VB6 TextBox is set up to accept multiple lines; confirmed that solved the immediate problem. Control properties you will want to check or set are MultiLine, WordWrap and ScrollBars so the text displays and scrolls the way you expect. (learn.microsoft.com)

Example pattern for reading a database field into a multiline TextBox and normalizing common line-ending variants so they display correctly on Windows:

Text1.MultiLine = True
Text1.ScrollBars = 2   ' vertical

Dim s As String
s = rs.Fields("Notes").Value & ""   ' avoid Null by forcing empty string
' normalize line endings: turn CRLF/CR/LF into CR+LF
s = Replace(s, Chr(13) & Chr(10), Chr(10))
s = Replace(s, Chr(13), Chr(10))
s = Replace(s, Chr(10), Chr(13) & Chr(10))

Text1.Text = s

Normalizing line endings avoids cases where data coming from Unix/macOS or HTML sources uses LF or <br> instead of Windows CR+LF; convert HTML <br> to newlines before display if needed. (geeksforgeeks.org)

If you need styled text (bold, bullets, links) use the RichTextBox control, but be aware it is an extra OCX and can be missing or require registration/licensing on newer development machines. If multiline text still does not appear, double-check that MultiLine is True at design time (ScrollBars is ignored when MultiLine is False) and that the field value is not Null before assigning. (stackoverflow.com)

Recommended Answers

All 5 Replies

One way is to add a new line character to each line of data that you add to the textbox. This will automatically display multiline data.

Thank you fotr your reply 'tinstaafl'

Will you please tell me how to add new line character and where?

.......waiting for your reply.

VB contains a constant for that(vbCrLf). As you read the data from the database, you put it into a string variable and add & vbCrLf anywhere in the string that you want a line break.

Here's a page of tutorials that might help you

Its working.
Thank you tinstaafl.

Please remeber to mark this solved. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.