...

View Full Version : VB.net line breaks



fazthegreat
01-23-2007, 03:15 AM
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?

Nischumacher
01-23-2007, 08:47 AM
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...

fazthegreat
01-23-2007, 05:48 PM
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%>

Roelf
01-25-2007, 01:50 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum