Click here to Skip to main content
15,180,707 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to display a text line by line which is something like this in vb.net

My name is Fred

I am 23 years old

I am from Malacca
Posted
Updated 17-Apr-21 0:27am

Please be more specific about where you want to display the text if it is in a textbox

You can write as below

VB
txtMyInfo.Multiline = True
txtMyInfo.Text= "My name is Fred" & vbCrLf & "I am 23 years old" & vbCrLf & "I am from Malacca"


or if it is in a label

VB
'The more VB style way
Label1.Text = "Hello" + vbCrLf + "How are you?"

or
'This works in almost any (.NET) language way
Label1.Text = "Hello" + Environment.NewLine +"How are you?"
   
v2
Comments
gogole_yuna 28-Aug-13 3:15am
   
ok thanks :)
If it is a textbox control then select the textbox and from properties change Multiline = True.

or if you use label control then select the label and from propersites change Autosize=False and re size.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900