|
-
February 18th, 2000, 11:23 AM
#1
Save My file
I'm looking 4 a way to save my file in my program.
How ca&n I say : Create a new file, and write this and this at this place?
Or open this file and read this this and this?
thanx
-
February 18th, 2000, 11:33 AM
#2
Re: Save My file
to write to a ".txt" file and make sure theres a folder called whatever:
open "c:\whatever\whatever.txt" for output as #1
write #1, text1
'if it says variable required, do this:
open "c:\whatever\whatever.txt" for output as #1
text1 = line
write #1, line
close #1
' make sure theres a textbox called text1 on your form
-
February 18th, 2000, 11:46 AM
#3
Re: Save My file
i will talk to you in like 5 hours, and give you answer to reading the file
-
February 18th, 2000, 12:00 PM
#4
Re: Save My file
I like to use the Scripting library for this:
Dim oFS as Scripting.FileSystemObject
Dim oStream as Scripting.TextStream
set oFS = new Scripting.FileSystemObject
'let's read a file here
set oStream = oFS.OpenTextFile("MYFILEPATHHERE")
While Not oStream.AtEndOfStream
MsgBox oStream.ReadLine()
Loop
'Now close the file
oStream.Close
'OK. We read a file. Now let's write one
set oStream = oFS.CreateTextFile("C:\WINDOWS\DESKTOP\Test.txt")
oStream.Write "This is a test"
oStream.Close
'Now release the objects
set oStream = nothing
set oFS = nothing
-
February 21st, 2000, 12:59 PM
#5
Re: Save My file
Thanks 4 your answer pal.
I tried it and it worked for only one textbox.
But how can I save for more than one box?
(I have to write +-30 boxes)
Chri
-
February 21st, 2000, 01:01 PM
#6
Re: Save My file
Thanx 4 your answer,...
Can you explain me how I can open a file and import text to +-30 different textboxes? (with diferent text)
Chri
Please reply at my E-MAIL ([email protected])
-
February 21st, 2000, 03:05 PM
#7
Re: Save My file
Don't hard code the file number. The correct way to get your file number (the as #) is to call FreeFile(). This will give you the next available file number.
You would need to repeat the code for each box. If you use an array of Text Boxes, you ca just loop through the array.
e.g.
'open your file here
Dim iFileNum as Integer
iFileNum = FreeFile()
Open "<<FilePathHere>>" for Output as iFileNum
for i = 0 to 29
write #iFileNum, txt(i).Text
next i
'Close Your File and clean up
-
February 25th, 2000, 12:56 PM
#8
Re: Save My file
thanks pal,
I'l have to rename all textboxses, but it's worth it...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|