473,322 Members | 1,703 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,322 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 2687
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.