Save

How do I save text in a text box into a text file with a fixed name and a fixed directory? Like,

If 'event happens' Then

save everything in the textbox to a.txt to C:\bla\
mrcool4444Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vin32Commented:
suppose the 'event' is a button click. then you write the foll. in sub button1_click:

dim file_i as integer

file_i = freefile
open "C:\bla\a.txt"  for input as #file_i

print #file_i text1.text

close #file_i

--------------------

that's all you need.
i maybe a little off the mark in syntax, as i am giving this off the cuff, but this is what you have to do.





0
Joe_GriffithCommented:
I think you want to open the file for "Output" not input.  Also you need to separate the file number from the data with a comma:

Open "C:\bla\a.txt" For Output As #file_i

Print #file_i, text1.text
0
mrcool4444Author Commented:
Um...it didn't work.  It said that the path for C:\bla\a.txt isn't found.  I changed the directory to C:\a.txt and it didn't work.  I even made a a.txt in C:\ and it still didn't work.  If you revise the code and post it as a answer and it works, then I will accept it, but this doesn't do what I need it to.  
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Vin32Commented:
i must have been asleep when i wrote that code: what Joe_Griffith says is right :-)

make the corrections, and that should do it.


0
AndySulzCommented:
Use a Rich Text Box and a common dialog control

commondialog1.showsave

richtextbox1.savefile commondialog1.filename
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndySulzCommented:
check.... richtextbox1.savefile commondialog1.filename , 1
0
mrcool4444Author Commented:
Huh?  Do what now?  I don't understand, what is a rich text box, a common dialog control?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.