Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > hard question


Reply
 
Thread Tools Display Modes
  #1  
Old 06-27-2002, 06:57 AM
andrewbean41
Guest
 
Posts: n/a
Default hard question


i have a form with 9 text boxes, each txt box holds a value, i want on the click of a button to be able to store these values in the html page supplied is this possible? if so, how?
Reply With Quote
  #2  
Old 06-27-2002, 07:10 AM
andrewbean41
Guest
 
Posts: n/a
Default

here is the html file if that helps. (in txt format)
Attached Files
File Type: txt stock delivery sheet.txt (523 Bytes, 6 views)
Reply With Quote
  #3  
Old 06-27-2002, 07:13 AM
quwiltw quwiltw is offline
Junior Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
Default

Looks like you should just be able to open the html file as a text file and just replace "Album X:" with "Album X:" & txtAlbumX.Text Is that what you're talking about?
Reply With Quote
  #4  
Old 06-27-2002, 07:16 AM
andrewbean41
Guest
 
Posts: n/a
Default

yeh. how do i add the data of a text file, into that txt file in the correct position?
Reply With Quote
  #5  
Old 06-27-2002, 07:45 AM
quwiltw quwiltw is offline
Junior Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
Default

Here's one way. If the files are very large, I think you might be better off changing the Replace function with something more efficient. Also, there are shortcuts to opening text files for reading the same as this opens it for output but I'm not very familiar with them. Search this forum for "writing text files" for more info.
Code:
Dim FileInput As String
Dim fs As FileSystemObject
Set fs = New FileSystemObject
Dim ts As TextStream
Set ts = fs.OpenTextFile("C:\temp\sample.txt", ForReading)
FileInput = ts.ReadAll()



ModifiedContent = Replace(FileInput, "Album 1:", "Album 1:" & Text1.Text)
Set ts = Nothing
Set fs = Nothing


FileNum = FreeFile
Open "C:\temp\sample_out.txt" For Output As #FileNum
Write #FileNum, ModifiedContent
Close #FileNum
Reply With Quote
  #6  
Old 06-27-2002, 08:06 AM
Volte's Avatar
Volte Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,343
Default

This code uses the FileSystemObject, which is extra overhead for
your program, and is generally not needed. You can do it using
standard VB file commands. In fact, the last part of the code uses
them. You can change it like this:

Code:
Dim FileInput As String
FileNum = FreeFile

Open "C:\temp\sample_out.txt" For Input As #FileNum
  FileInput = Replace(FileInput, "Album 1:", "Album 1:" & Text1.Text)
Close #FileNum

Open "C:\temp\sample_out.txt" For Output As #FileNum
  Write #FileNum, ModifiedContent
Close #FileNum
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
 
 
-->