Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB.net line breaks

    Hey guys, I'm new to the world of programming.I'm working in vb.net and I'm trying to generate an error message based on what is strored in the variable.
    The code is as follows:
    Dim ErrMsg as string
    ErrMsg=""

    If (txt_fname.text = "") then

    ErrMsg ="Please enter the following information:" & vbCrLf & "first name"

    End if

    and so it goes on checking for rest of the empty fields and updating the ErrMsg variable. The problem is that the line break is not working.What am I doin wrong?

  • #2
    Regular Coder Nischumacher's Avatar
    Join Date
    Oct 2005
    Location
    Bombay, India
    Posts
    196
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Although 'vbCrLf' should work fine...
    Just try '<br>' or '\n' for the heck of it...

    How are you displaying the ErrMsg ?
    Label... or MsgBox... or something else...
    - NS 666
    .net DEVILoper

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well <br> worked, thanks.But just wondering why vbCrlf did'nt work.This is how I am generating the error message.I'm not using a label or message box.

    <%if ErrMsg<>"" then%>
    <tr>
    <td colspan="2" align="left" valign="top" style="background-color:#FFFF00;color:red"><%=ErrMsg%></td>
    </tr>
    <%end if%>

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    In case you are displaying in a browser, you have to include html code to generate markup like a linebreak.

    If you use vbCrLf, the linebreak will only be in the output by the serverside code, meaning: the sourcecode of your page (you can check this with view source). This doesn't render automatically to a linebreak in the viewed page.
    I am the luckiest man in the world


  •  

    Posting Permissions

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