 |

06-27-2002, 06:57 AM
|
|
|
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?
|
|

06-27-2002, 07:10 AM
|
|
|
|
here is the html file if that helps. (in txt format)
|
|

06-27-2002, 07:13 AM
|
|
Junior Contributor
|
|
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
|
|
|
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?
|
|

06-27-2002, 07:16 AM
|
|
|
|
yeh. how do i add the data of a text file, into that txt file in the correct position?
|
|

06-27-2002, 07:45 AM
|
|
Junior Contributor
|
|
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
|
|
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
|
|

06-27-2002, 08:06 AM
|
 |
Ultimate Contributor
Retired Leader * Guru *
|
|
Join Date: Aug 2001
Posts: 5,343
|
|
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
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|