Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


vbcrlf ? why isn't this working?

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,2920
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> vbcrlf ? why isn't this working?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 vbcrlf ? why isn't this working? - 5/8/2005 11:08:01 PM   
  ES

 

Posts: 3
Score: 0
Joined: 5/8/2005
From:
Status: offline
Hi,

I am using asp and vbscript. I would like to put a carriage return and line feed in a string of text. This code still generates all of the text on one line. I don't understand why. I have also tried substituting the vbcrlf for chr(10) & chr(13), but I still have the string output on one line. ???? It seems like a simple problem, but I must be missing something.

Any help would be appreciated. Thanks!

Code:

<%
Response.Write("My name is Jane. ") & vbCRLF
Response.Write("It is May 9th.") & vbCRLF & vbCRLF & vbCRLF
Response.Write("Have a great day!")
%>
 
 
Post #: 1
 
 Re: vbcrlf ? why isn't this working? - 5/9/2005 12:39:20 AM   
  willem

 

Posts: 12
Score: 0
Joined: 4/25/2005
From: France
Status: offline
try this:

<%
Response.Write("My name is Jane. " & vbCRLF)
Response.Write("It is May 9th." & vbCRLF & vbCRLF & vbCRLF)
Response.Write("Have a great day!")
%>

(in reply to ES)
 
 
Post #: 2
 
 Re: vbcrlf ? why isn't this working? - 5/9/2005 12:41:04 AM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear ES,
vbCrLf doesn't wotk in HTML. When u use the response.write u r using HTML, so to do line breaks use the <BR>

<%
Response.Write("My name is Jane. " & "<BR>")
Response.Write("It is May 9th.<BR><BR><BR>")
Response.Write("Have a great day!")
%>

Hope this Helps

Best Regards
Firas S Assaad

(in reply to ES)
 
 
Post #: 3
 
 Re: vbcrlf ? why isn't this working? - 5/9/2005 1:54:01 AM   
  ES

 

Posts: 3
Score: 0
Joined: 5/8/2005
From:
Status: offline
Thank you both for your comments. I am actually trying to create a string in VBScript which will be passed to make a pdf. So, I am not using any HTML, just VBScript and the pdf maker. But, even when I try this code as the only code in my asp page, I still get it all on one line:

<%@LANGUAGE="VBSCRIPT" %>

<%
Response.Write("My name is Jane. " & vbCRLF)
Response.Write("It is May 9th." & vbCRLF & vbCRLF & vbCRLF)
Response.Write("Have a great day!")
%>


???

Any other ideas out there?

Thanks in advance!

(in reply to ES)
 
 
Post #: 4
 
 Re: vbcrlf ? why isn't this working? - 5/9/2005 3:30:51 AM   
  willem

 

Posts: 12
Score: 0
Joined: 4/25/2005
From: France
Status: offline
Dear ES,

As Firas rightly posted, the vbCRLF does not work in this case, it does not render on an html page. I don't know what your PDF converter accepts incoming, but if it accepts html, then you need to replace the vbCRLF by <BR> tags.
If it accepts straight "notepad" text, then you should not be writing this to the response object, but you should probably be building a text string to pass to the pdf like:

sPDFString="My name is Jane. " & vbCRLF
sPDFString=sPDFString & "It is May 9th." & vbCRLF & vbCRLF & vbCRLF
sPDFString=sPDFString & "Have a great day!"

and something like

rc=CreatePDFfromString(sPDFString)

or create a textfile from your string which you can pass to your converter.
good luck, and let us know if this helps,

Willem

(in reply to ES)
 
 
Post #: 5
 
 Re: vbcrlf ? why isn't this working? - 5/9/2005 6:31:26 AM   
  ES

 

Posts: 3
Score: 0
Joined: 5/8/2005
From:
Status: offline
Willem,

Thank you for your help. It seems then that the pdf (I am using the Freeware fpdf.asp) software must not support crlf. I have tried to build a string as you suggested, but it is always in one line. I will try to figure out a work around.

Thank you again for your help and comments!

(in reply to ES)
 
 
Post #: 6
 
 Re: vbcrlf ? why isn't this working? - 5/19/2005 4:31:09 PM   
  aksh2rule

 

Posts: 10
Score: 0
Joined: 5/18/2005
From:
Status: offline
Check this out:
It might help

This is the ascii combination for vbcrlf
Chr(13)+Chr(10)

(ascii 13 ==> Carriage return without linefeed)
(ascii 10 ==> Linefeed)

Get back if it works ;-)

(in reply to ES)
 
 
Post #: 7
 
 Re: vbcrlf ? why isn't this working? - 6/10/2005 4:12:58 AM   
  pkarovsky

 

Posts: 1
Score: 0
Joined: 6/10/2005
From:
Status: offline
I too am having problems with vbCrLf and vbTab

I'm testing a form I created in Dreamweaver that posts to an asp file. Here's a short version of the asp file.

<%@ LANGUAGE = "VBScript" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
emailText = "Registration Form Information: " &vbCrLf
emailText = emailText & "NAME: " & request.form("name") &vbCr
emailText = emailText & "ADDRESS: " & request.form("address1") &vbCr
emailText = emailText & "CITY: " & request.form("city") &vbTab
emailText = emailText & "STATE: " & request.form("state") &vbTab
emailText = emailText & "ZIP: " & request.form("zip") &vbTab
emailText = emailText & "REG FEE": " & request.form("regfee") $vbTab
emailText = emailText & "REG TOTAL": " & request.form("GrandTotal") $vbCr
emailText = emailText & "CONTRIBUTION": " & request.form("contrib") $vbTab
emailText = emailText & "TOTAL DUE": " & request.form("totaldue") $vbCrLf
%>

</head>

The output I get when I submit my form to the server is
NAME:SomeoneADDRESS:SomewhereCITY:SeattleSTATE:WAZIP:98045 etc etc

(in reply to ES)
 
 
Post #: 8
 
 Re: vbcrlf ? why isn't this working? - 6/10/2005 7:54:19 AM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear ES,
In C++ they use the \n to go to a new line, so why don'y u try it, it might work...

(in reply to ES)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> vbcrlf ? why isn't this working? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts