Line Break in an Error message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dougancil
    Contributor
    • Apr 2010
    • 347

    Line Break in an Error message

    I have the following lines of code in my codebehind and want to insert a line break, I just don't know how to do this.


    Code:
    Checking if the file upload control contains a file
            If Not File1.PostedFile Is Nothing And File1.PostedFile.ContentLength > 0 Then
                Try
                    'checking if it was .txt file BEFORE UPLOADING IT!
                    'You used to upload it first...but the file could be a virus
                    If File1.FileName = ("doug.csv") = False Then
                        'The file is not the expected type...do not upload it
                        'just post the validation message
                        message.Text = "Sorry, thats not the correct file. [B]HERE is where I'd like the line break[/B] Please locate and upload 'doug.csv'"
                    Else
                        'The file is a .txt file
                        'checking to see if the file exists already
                        'If it does exist Deleting the existing one so that the new one can be created
                        If IO.File.Exists(SavePath) Then
                            IO.File.Delete(SavePath)
                        End If
    I know that in VB its [space]_[space] to do carriage returns in coding, but I'm sure it's different with asp.net
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by dougancil
    I have the following lines of code in my codebehind and want to insert a line break, I just don't know how to do this.


    Code:
    Checking if the file upload control contains a file
            If Not File1.PostedFile Is Nothing And File1.PostedFile.ContentLength > 0 Then
                Try
                    'checking if it was .txt file BEFORE UPLOADING IT!
                    'You used to upload it first...but the file could be a virus
                    If File1.FileName = ("doug.csv") = False Then
                        'The file is not the expected type...do not upload it
                        'just post the validation message
                        message.Text = "Sorry, thats not the correct file. [B]HERE is where I'd like the line break[/B] Please locate and upload 'doug.csv'"
                    Else
                        'The file is a .txt file
                        'checking to see if the file exists already
                        'If it does exist Deleting the existing one so that the new one can be created
                        If IO.File.Exists(SavePath) Then
                            IO.File.Delete(SavePath)
                        End If
    I know that in VB its [space]_[space] to do carriage returns in coding, but I'm sure it's different with asp.net
    Concanate vbNewLine in you message

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      As ThatThatGuy suggested you need to append the VB new line. You can do this using VBLF or Environment.New Line
      :)

      -Frinny

      Comment

      Working...