Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Text files and Inner Workings


Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2002, 06:09 PM
GGKauten
Guest
 
Posts: n/a
Default Text files and Inner Workings


ok here is my problem. I have a program which produces a list of dimensions needed to build a subwoofer enclosure. What I have planned to do is pre-make some text files with HTML coding to show an image at the top in the center, but then have my program take the text in a text box and load it into the file underneath the image. I don't need it to write the HTML code for the text as I can just put it in the file. But thats the problem. i don't know how to take whats in my text box and add it into the file without overwriting what's already in the file. Then I want to save that text file with an *.html extension. Any ideas? I would love to hear some. Thank you.
Reply With Quote
  #2  
Old 10-10-2002, 06:37 PM
1acre4me2p
Guest
 
Posts: n/a
Default

There is no easy way you still have to write the HTML Code no matter what you do.
Open the main file for read
Open a second file for Write
As you read each line search for the position you want to place the new text and write each line to the new file.
When you've found it - write the new text to the new file.
Then continue reading and writing the Original file to the new file.
Delete the old file and rename the new file as the old file.

Good luck
Reply With Quote
  #3  
Old 10-10-2002, 06:40 PM
randtek's Avatar
randtek randtek is offline
Contributor
 
Join Date: Jun 2002
Location: the Milky Way Galaxy
Posts: 525
Default

I would put text in the text file that will represent the places where you want to insert text. Use something that would not normally occur in a text file, such as %$Field1$%. Then just use the replace function to replace it with the textbox text.
__________________
Murphy was an optimist!
Reply With Quote
  #4  
Old 10-10-2002, 06:53 PM
1acre4me2p
Guest
 
Posts: n/a
Default

Isn't the replace function in the VB IDE.
You still have to read the old file and write to a new file to include any text.
HTML can also include text from a file onto the screen just change the text file to change the text - no messing with the HTML file.

Steve.
Reply With Quote
  #5  
Old 10-10-2002, 07:00 PM
randtek's Avatar
randtek randtek is offline
Contributor
 
Join Date: Jun 2002
Location: the Milky Way Galaxy
Posts: 525
Default

The Replace function is a function of VB. It is used for replacing a character or characters in a string with another character or string. I am not referring to the replace operation of the IDE.

Code:
Dim String1 as String Dim String2 As String String1 = "This is a test" String2 = "is not" String1 = Replace(String1, "is", String2)

After running this code, String1 would be "This is not a test"
__________________
Murphy was an optimist!
Reply With Quote
  #6  
Old 10-10-2002, 11:13 PM
1acre4me2p
Guest
 
Posts: n/a
Default

Sorry I stand corrected. (Haven't used that one)


Steve
Reply With Quote
  #7  
Old 10-11-2002, 03:46 AM
randtek's Avatar
randtek randtek is offline
Contributor
 
Join Date: Jun 2002
Location: the Milky Way Galaxy
Posts: 525
Default

No problem! We're all here to learn.
__________________
Murphy was an optimist!
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
 
 
-->