473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

replace <br> with NL

How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom
Nov 19 '05 #1
15 2691
dim str as string = "hello<br>world"

dim newString as string = str.Replace("<br>", System.Environment.NewLine)

or you could use VbCrLf....I prefer Environment.NewLine

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom

Nov 19 '05 #2
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom

Nov 19 '05 #3
dim str as string = "hello<br>world"

dim newString as string = str.Replace("<br>", System.Environment.NewLine)

or you could use VbCrLf....I prefer Environment.NewLine

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom

Nov 19 '05 #4
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom

Nov 19 '05 #5
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)
Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom


Nov 19 '05 #6
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)
Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom


Nov 19 '05 #7
Weird. Perhaps its expecting one or the other but not both. Try
replacing it with vbCR only or vbLf only.
On Mon, 14 Feb 2005 13:12:19 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom



Nov 19 '05 #8
Weird. Perhaps its expecting one or the other but not both. Try
replacing it with vbCR only or vbLf only.
On Mon, 14 Feb 2005 13:12:19 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom



Nov 19 '05 #9
"Tom wilson" <ye*******@nospam.com> wrote in message
news:hp********************************@4ax.com...
Weird. Perhaps its expecting one or the other but not both. Try
replacing it with vbCR only or vbLf only.
I wouldn't think so as if one or the other worked, so would vbCrLf and
System.Environment.NewLine.

I am sending the email from Outlook, so I would have assumed that the <br>
would work.

Tom


On Mon, 14 Feb 2005 13:12:19 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl.. .
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine) , I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom

Nov 19 '05 #10
"Tom wilson" <ye*******@nospam.com> wrote in message
news:hp********************************@4ax.com...
Weird. Perhaps its expecting one or the other but not both. Try
replacing it with vbCR only or vbLf only.
I wouldn't think so as if one or the other worked, so would vbCrLf and
System.Environment.NewLine.

I am sending the email from Outlook, so I would have assumed that the <br>
would work.

Tom


On Mon, 14 Feb 2005 13:12:19 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl.. .
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine) , I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom

Nov 19 '05 #11
I always do this in code via the sendmail object, but if you do it this way
are you sure the default is to accept html (vs. text), or do you need to call
that out somewhere?

"tshad" wrote:
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom



Nov 19 '05 #12
I always do this in code via the sendmail object, but if you do it this way
are you sure the default is to accept html (vs. text), or do you need to call
that out somewhere?

"tshad" wrote:
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom



Nov 19 '05 #13
re:
For example:
I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"
That is a text link.
You can't use HTML in text links.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
=====================

"tshad" <ts**********@ftsolutions.com> wrote in message
news:O6**************@TK2MSFTNGP14.phx.gbl... "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom



Nov 19 '05 #14
re:
For example:
I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"
That is a text link.
You can't use HTML in text links.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
=====================

"tshad" <ts**********@ftsolutions.com> wrote in message
news:O6**************@TK2MSFTNGP14.phx.gbl... "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is this what you're looking for?
MyString = MyString.Replace("<br>",vbcrlf)


Actually, both were what I was looking for, but it doesn't work for my
mailto tag.

I am trying to send text that has line breaks in them in body of the
message:

For example:

I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"

This works fine as far as when my email program comes up but in the body I
get:

this is<br><br>a test

If I do a msg.replace("<br>",vbCrLf) or
msg.replace("<br>",System.Environment.NewLine), I get:

this isatest

I never get the line break.

What am I missing?

Thanks,

Tom


--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
How do I go about this?

I used to know this, but can't find VB.net replace that does this.

Something like

string.replace("<br>",NL)

Thanks,

Tom



Nov 19 '05 #15

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
re:
For example:
I set a variable msg = " <a href='mailto:tf*@yahoo.com?subject=Re:
Interview&body=this is<br><br>a test'>Email Me</a>"


That is a text link.
You can't use HTML in text links.


But the problem is I can't seem to use linefeeds,either.

Here is the program that sends 2 <br>s and it shows on the email we are
trying to send:
************************************************** *******************
<%@ Page Language="VB" trace="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="System.Web.Mail" %>
<script runat="server">
sub sendEmail(sender As Object, e As System.EventArgs )

Dim mailTo as String = "Email: <a
href=""mailto:ts*****@yahoo.com?subject=Our test&body=This is line
1<br><br>This is line2 "">to Tom</a>"

Dim Message As New MailMessage()
message.From = "ts@fts.com"
message.To = "ts@fts.com"
message.Subject = "Email test"
message.Body = mailTo
trace.warn("mailto = " & mailto)
message.Body = mailTo
message.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "localhost"
smtpMail.Send(message)
end sub
</script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form runat="server">
Send Email: <asp:Button ID="btnEmail" Text="Send" OnClick="SendEMail"
runat="server" />
</form>
</body>
</html>
************************************************** ********************
When I press the link my email program comes up with:

This is line 1<br><br>This is line2

If I change the program to change the <br><br> to vbCrLf, I get the
following program:
************************************************** ******************
<%@ Page Language="VB" trace="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="System.Web.Mail" %>
<script runat="server">
sub sendEmail(sender As Object, e As System.EventArgs )

Dim mailTo as String = "Email: <a
href=""mailto:ts*****@yahoo.com?subject=Our test&body=This is line
1<br><br>This is line2 "">to Tom</a>"

Dim Message As New MailMessage()
message.From = "ts@fts.com"
message.To = "ts@fts.com"
message.Subject = "Email test"
message.Body = mailTo

mailto = mailTo.replace("<br>",vbCrLf)

trace.warn("mailto = " & mailto)
message.Body = mailTo
message.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "localhost"
smtpMail.Send(message)
end sub
</script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form runat="server">
Send Email: <asp:Button ID="btnEmail" Text="Send" OnClick="SendEMail"
runat="server" />
</form>
</body>
</html>
************************************************** *******************

If you look at the web page the mailto line is (notice that it skips 2
lines - so the CRLF seems to be there:
************************************************** ********************
<a href="mailto:ts**********@yahoo.com?subject=Our test&body=This is line 1

This is line2 ">to Tom</a><BR>
************************************************** *******************

But when I press the buttom the email program comes up and this is
displaying:

This is line 1This is line2

It seems to have stripped out the CRLFs.

Tom
Nov 19 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: fis | last post by:
Hi all, I've problem because there are needed break lines in my texts on the web site but i can't do it :( My pipeline looks like: XMS -> I18N -> XSLT -> HTML I have lot of texts in my...
6
by: Lasse | last post by:
I have done this simple function, it seems to work as intended, to solve a problem i have had for a while. I couldnt find any sample around that was working for me. I would like to test it with...
7
by: noor.rahman | last post by:
I have an XML file that stores data from an HTML form. I use XSL to display the data in HTML format. The data may have newline characters. However, XSL is not displaying the newlines properly in...
0
by: tshad | last post by:
How do I go about this? I used to know this, but can't find VB.net replace that does this. Something like string.replace("<br>",NL) Thanks,
13
by: CK | last post by:
Hi all, I have a textarea control. I am putting it's value in an html email. The problem is that the new lines are being ignored. I want to take the controls value and replace any newline...
7
by: Nathan Sokalski | last post by:
Something that I recently noticed in IE6 (I don't know whether it is true for other browsers or versions of IE) is that it renders <br/and <br></br> differently. With the <br/version, which is what...
3
by: Alun | last post by:
I need to replace all new line characters in a string with a valid XHTML line break tag <br />. I'm trying to use the string.Replace method for this. Here's some example code: String...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.