|
-
Oct 10th, 2000, 04:05 AM
#1
Thread Starter
Member
How can i create a textfile that include the data of two
textboxes on my form and save it on a disk?
-
Oct 10th, 2000, 04:37 AM
#2
Addicted Member
You can use some thing like this:
mytxtfile = App.Path & "\txtfile.txt"
Open mytxtfile For Output As #1 ' Open file for input.
txttosave = text1.Text
Write #1, txttosave
Close #1
,,,,,,,,,,,,,,,,,,
Try and work arround
Regards
-
Oct 10th, 2000, 04:43 AM
#3
Lively Member
The old way to do this would be to use File I/O or Input/Output, but the way that Microsoft would like you to do it now is to use File System Objects.
First, you need to add a referrence to the Microsoft Scripting Runtime component. Having done that, declare the following variable:
Code:
Dim FSys As New FileSystemObject
Then the function that you use to write to the text file will be
Code:
Dim OutStream as Textstream
Set OutStream = FSys.CreateTextfile("C:\windows\mytext.txt")
Outstream.Write(Text1.text & Text2.text)
'and to finish off, save system resources by clearing
'OutStream - not necessary, but a good habit...
Set OutStream = Nothing
Hope that helps :-) Run a search on File System Objects and you should get more help if you need it.
-
Oct 10th, 2000, 05:21 AM
#4
Thread Starter
Member
lines
how can i set data of textbox 1 in line 1
and data of textbox to line 2 of an created txtfile?
-
Oct 10th, 2000, 07:08 AM
#5
Thread Starter
Member
????
To put data from one textbot into a txtfile is easy
but how can i put data into 2 seperatet lines from 2 seperatet text boxes?????????
-
Oct 10th, 2000, 02:15 PM
#6
Lively Member
Is this what u mean?
Code:
Dim OutStream as Textstream
Set OutStream = FSys.CreateTextfile("C:\windows\mytext.txt")
Outstream.Write(Text1.text & vbCrLf & Text2.text)
'and to finish off, save system resources by clearing
'OutStream - not necessary, but a good habit...
Set OutStream = Nothing
-
Oct 11th, 2000, 03:07 AM
#7
Thread Starter
Member
Nope...it doesnt work!
any else ideas?
-
Oct 11th, 2000, 04:37 AM
#8
Thread Starter
Member
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
|