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
Printable View
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
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
i will talk to you in like 5 hours, and give you answer to reading the 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
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
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])
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
thanks pal,
I'l have to rename all textboxses, but it's worth it...