Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Conversion to HTML


Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2003, 03:28 AM
SuperfastOz SuperfastOz is offline
Freshman
 
Join Date: Jun 2003
Posts: 25
Default Conversion to HTML


I can't get to my laptop right now, so I'll ask here to save me having to change all the code later.

I need to scan through a text segment and replace a line break with the "<br>" html code.

I tried this:

Code:
Txt1 = Replace(Txt1, Chr(13), "<br>")

But it's screwing up other parts of the code. Any alternatives?
Reply With Quote
  #2  
Old 08-10-2003, 04:54 AM
Csharp's Avatar
Csharp Csharp is offline
Senior Contributor

* Expert *
 
Join Date: Jul 2003
Location: Ashby, Leicestershire.
Posts: 967
Default

have you tried allowing for the other types of return? eg: Chr(10) , VbCrlf ...
here's an example of just replacing a few.
Code:
Txt1.Text = Replace(Replace(Replace(Txt1.Text, Chr(10), "<br>"), Chr(13), "<br>"), vbCrLf, "<br>")
__________________
~~ please don't PM me regarding code, I only reply to personnal messages ~~
Reply With Quote
  #3  
Old 08-10-2003, 05:27 AM
samr samr is offline
Senior Contributor
 
Join Date: Jul 2003
Location: London, England
Posts: 993
Default

vbCrLf = chr(10) & Chr(13), so you don't need the last replace.
if you only want to replace the first one then you could use something like:
Code:
Pos = instr(txt1.text, vbCrLf) txt1.text = left(txt1.text, Pos) & "<br>" & _ rigth(txt1.text, len(txt1.text) - Pos - 2)
but you'll have to play around with it to check that the charactrs are removed - you'll probably have to add or take off 1 from the Pos value - but not sure
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color in Outlook using CDO adebuigny Word, PowerPoint, Outlook, and Other Office Products 7 09-18-2003 08:33 PM
Excel Data to E-mail by range robograj Excel 14 07-01-2003 01:41 AM
HTML / CSS within a VB script manchego Web Programming 3 06-24-2003 12:28 PM
Send Email with graphics and text Greatchap Communications 2 05-16-2003 06:44 AM
html to xhtml conversion with HTMLDOM hackemall General 12 11-30-2001 06:48 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->