Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Go Back  Xtreme Visual Basic Talk > > > Reading a HTML file and replacing certain parts.


Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2010, 06:54 PM
DY357LX DY357LX is offline
Newcomer
 
Join Date: Jun 2003
Posts: 20
Default Reading a HTML file and replacing certain parts.


A friend of mine has no HTML knowledge so I'm attempting to write a program that replaces certain parts of a html file to suit his needs.

I've edited the HTML file and marked certain parts with "tags" like this:

#IMAGEURL1#

I have a textbox where he can copy + paste an image URL and hopefully the #IMAGEURL1# is replaced with the contents of the textbox.

So can someone please enlighten me to-as how to open a HTML file (there's no textbox to display the contents just yet, I'll add one if needed), find the specified text and then replace it with whats in a textbox.

Thanks.
Reply With Quote
  #2  
Old 12-03-2010, 10:25 AM
wildfire1982 wildfire1982 is offline
Senior Contributor
 
Join Date: Jul 2003
Location: Southampton UK
Posts: 801
Default

Hello,

If you would like to open an HTML file, it is plain text so exactly the same as a .txt file or anything else that notepad can open. Have a look Here at the tutorial in the tutors corner, this will show you how to read a text file.

With regards to replacing parts of the string, look up string.replace. There are loads of ways to replace strings. This is arguably the simplest and probably what you are looking for.

Give this a try and if you get stuck, give us a shout with what you have so far or any specific questions.
__________________
Chris
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

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
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts. Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
 
Reading a HTML file and replacing certain parts.
Reading a HTML file and replacing certain parts.
 
-->