Suraj
Suraj

Reputation: 3127

How can I make a label multiline?

I have a Label that has a large amount of text. The value comes from a database. What I want is to view that text in a multiline Label but if the text is more than the width of the Label it cuts down.

Like:

----------------------------------
|This is a label and I want it to|
----------------------------------

But I want this:

-----------------------------------------------
|This is a label and I want it to be multiline|
|when needed.                                 |
-----------------------------------------------

Upvotes: 26

Views: 73216

Answers (4)

Jonathan Pizzicoli
Jonathan Pizzicoli

Reputation: 1

You can use a ComboBox with BackColor same as Parent, Border None and Multiline True

Upvotes: -1

Pratik Patel
Pratik Patel

Reputation: 151

Go to Label Properties >> AutoSize = True, False

Upvotes: 16

BABU VELUKUNNEL
BABU VELUKUNNEL

Reputation: 41

You can display the required message in multiline on a lable.

To accomplish this you have to assign the required data into a variable in multiline.

Use the following codes to accomplish this:

variable += variable + vbCrLf

This will help you assign the variable in multiline

label1.text = variable ' 

This will help to serve your purpose

Upvotes: 4

user6653563
user6653563

Reputation:

Follow these steps,

Go to properties of the label and set AutoSize : false

Now expend your label to max size of the content like.

--------------------------------------------------
|                                                 |
|                                                 |
--------------------------------------------------

Now your text will not be go outside of the label and automatically go to next line when reach the end of the label.

Upvotes: 37

Related Questions