How to add LineBreak in Text(String) in VB.Net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jay123
    New Member
    • Sep 2008
    • 121

    How to add LineBreak in Text(String) in VB.Net

    Hello,
    I have a string which i need to display in 3 lines.
    Code:
    i.e. Label.Text = "a" & vbCrLf & "b" & vbCrLf & "c"
    I want above text to appear in 3 lines, but no matter what i do, it appears in single line. I cant have three labels as whole situation is very complex then i have given above.

    I have tried 'ControlChars.N ewLine', 'vbCr', 'vbCrLf' but nothing seems to be working.

    I wonder if we can actually acheive this in VB.Net.

    I hope someone will be point me in right direction.

    Thanks
    Jay
  • jay123
    New Member
    • Sep 2008
    • 121

    #2
    Silly me

    this worked (never expected though)
    Code:
    Label.Text = "a" & "<br />" & "b" & "<br />" & "c"

    Comment

    • R MacDonald
      New Member
      • Mar 2011
      • 24

      #3
      Hi, jay123,

      You would use the first method (i.e. with vbCrLf) on a Windows Form. The second mentod (i.e. with "<br />") is appropriate for a web page.

      Cheers,
      Randy

      Comment

      Working...