473,394 Members | 1,935 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,394 software developers and data experts.

replace linefeeds in text?

I'm trying to get linefeeds to display correctly in a datagrid (text is
taken from a database of text that has been htmlencoded)

By default it doesn't display them. But <br/> tags display fine.
however, when I do

validated.Replace(vbCrLf, "<br/>")

or

validated.Replace(chr(10), "<br/>")

or

validated.Replace(chr(13), "<")

or even a function with this

While (posistion < validated.Length And posistion > -1)

posistion = validated.IndexOf(vbcrlf, posistion) (tried the other
combinations)

If posistion = -1 Then
Exit While

End If

validated.Remove(posistion, 1)

validated.Insert(posistion, "<br/>")

posistion = posistion + 5

End While

None of that seems to remove and replace at all.. can anyone suggest what I
can do?

Nov 18 '05 #1
1 1195
Try
validated = validated.Replace(vbCrLf, "<br />")

Unlike VB6, the Replace method returns the modified string and does not
modify the original string.

More on the Replace method:
http://msdn.microsoft.com/library/de...placetopic.asp

"Grant Mills" <mi**********@noDamSpamTelusplanet.net> wrote in message
news:WSVpc.11002$RM.1528@edtnps89...
I'm trying to get linefeeds to display correctly in a datagrid (text is
taken from a database of text that has been htmlencoded)

By default it doesn't display them. But <br/> tags display fine.
however, when I do

validated.Replace(vbCrLf, "<br/>")

or

validated.Replace(chr(10), "<br/>")

or

validated.Replace(chr(13), "<")

or even a function with this

While (posistion < validated.Length And posistion > -1)

posistion = validated.IndexOf(vbcrlf, posistion) (tried the other
combinations)

If posistion = -1 Then
Exit While

End If

validated.Remove(posistion, 1)

validated.Insert(posistion, "<br/>")

posistion = posistion + 5

End While

None of that seems to remove and replace at all.. can anyone suggest what I can do?

Nov 18 '05 #2

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

Similar topics

0
by: Harriet Bazley | last post by:
I've done a Google Groups search, read the 1,000-odd articles on this group currently present on my news server, and read the FAQ at http://www.htmlhelp.org/faq/html/all.txt, but I can't find any...
23
by: SeaPlusPlus | last post by:
I want to convert large files of prose to xhtml and so I need a way to remove unwanted line wraps. So, I'm looking for a freebee editor that has the capability of searching for a single "carriage...
5
by: andrewcw | last post by:
Simple question - I have a text box and the multiline,and word wrap are turned on. this.txtProcessInfo.Text="a\n\b\nc\n"; I think this would display as a b c but I just get abc.
3
by: lino | last post by:
Hello, I have the following string: const char plaintext = "Fourscore and seven years ago our \ fathers brought forth upon this continent \ a new nation, conceived in liberty, and dedicated...
2
by: Grant Mills | last post by:
I'm trying to get linefeeds to display correctly in a datagrid (text is taken from a database of text that has been htmlencoded) By default it doesn't display them. But <br/> tags display fine. ...
15
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,
2
by: Øyvind Isaksen | last post by:
Hi! I use this function to show the text with linefeeds on my webpages: ----------------------------------- replace(myText,Chr(13),"<br>") ---------------------------------- This works...
0
by: Kevin Hodgson | last post by:
I'm having a problem with System.Web.Mail.MailMessage losing linefeeds when creating an email. This is a VB.NET project. I use a stringbuilder to construct the MailMessage.Body and use vbCrLf...
1
by: dino d. | last post by:
I need to parse a string by linefeeds and paragraphs. I need to preserve all periods and linefeeds too, so I can't simply use strtok or explode (both of which don't tell you where or which (period...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.