By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,130 Members | 2,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,130 IT Pros & Developers. It's quick & easy.

replace linefeeds in text?

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.