Results 1 to 3 of 3

Thread: [RESOLVED] Append to label with linefeeds ?

  1. #1

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    Resolved [RESOLVED] Append to label with linefeeds ?

    Guys,

    Why isn't this code working ? It should be reading text from rows in a datatable, then appending the text to a string along with a couple of line feeds for clarity. I'm then setting the label.text (guidetext) to the string.

    It is showing the text from the rows, but as one string without any linefeeds.
    I've also tried VbCrLF's too.

    Cheers
    Bob


    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         'Put user code to initialize the page here
    3.  
    4.         Dim sText As String
    5.         Dim dt As New DataTable
    6.         db.Guidelines.Fill(dt, CType(Session("Section"), Integer))
    7.         For Each row As DataRow In dt.Rows
    8.             sText += vbNewLine & vbNewLine & row("Text")
    9.         Next
    10.         guidetext.Text = sText
    11.     End Sub
    Last edited by staticbob; Sep 6th, 2005 at 08:29 AM.

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: Append to label with linefeeds ?

    You need to replace line feeds with the HTML line break (<br> or <br /> depending which version you are using).

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  3. #3

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    Re: Append to label with linefeeds ?

    Thanks dj.

    Bob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width