How to save the contents in a text box to a .txt file

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
marcmarteleira





Posts: 137
Joined: Sun Jan 30, 2005 7:32 am
Location: Mississauga

How to save the contents in a text box to a .txt file

Post by marcmarteleira »

How to save the contents in a text box to a .txt file in a area of there computer that you get to choose, can any1 tell me how to do this kinda like this say your registering a product and u have to mail in the sheet so u type everything in u click the button and it saves the info in a txt file somewhere on your computer where u get to choose. How can i do so?
Signature exceeded 500x120 pixels.
Cheech|N|Chong





Posts: 115
Joined: Fri Jan 14, 2005 9:26 am
Location: Why The Fuck Would I Tell You? Indiana...
Contact:

Post by Cheech|N|Chong »

Type this in the command button (code):

(Change "Text1.Text" to the name of the textbox you have)

Code: Select all

Dim Text As String

Open "C:\Documents and Settings\All Users\Desktop\Sample.txt" For Output As #1
Text = Text1.Text
Print #1, "This is whats contained in the Text1.Text Textbox: " + Text

Close #1

intMsg = MsgBox("File sample.txt Written")
Signature exceeded 75KB.
Onetoomanysodas





Posts: 325
Joined: Mon Mar 22, 2004 3:59 pm
Location: Everywhere but nowhere
Contact:

Post by Onetoomanysodas »

Yeah but he's asking if you can change the location it saves. Setting the save location to the value of the text box doesn't work.
TfAv1228




Miner Logistician Droplet

Posts: 276
Joined: Sun Sep 05, 2004 4:40 pm

Post by TfAv1228 »

u would use 2 text opens and save with these one would have the location of the text file u want to move the other would have its contents



Save
_________________________

file = FreeFile
exe2 = example.Text
Open "C:\something.txt" For Output As #file
Print #file, exe2
Close #file

MsgBox "File Saved!", vbInformation, "Saved"


Open
______________________________________

file = FreeFile

Open "C:\something.txt" For Input As #file
exe2 = Input(LOF(file), 1)
Close #file

example2.Text = exe2
Sig breaks rules, read the rules before reposting.
Post Reply