Solved

Saving Data to disk

Posted on 2000-03-06
5
139 Views
Last Modified: 2010-05-02
I need to save data, namely text, to disk. How do I do this. What command do I use?
0
Comment
Question by:R_N_WARD
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
pit_ earned 50 total points
Comment Utility
The easiest way to save text to a file is to first, open a file on the disk, then write the text out, and then close the file.


Dim ff As Integer
Dim strFileName as String

ff = FreeFile
strFileName = "data.txt"

Open strFileName For Output As ff
Print #ff, strData
Print #ff, strData2
  ...
Close ff
0
 
LVL 2

Expert Comment

by:danelroisman
Comment Utility
'Save text into the file:
Dim number As Integer
number = FreeFile

Open "Text.txt" & MyIndex For Output As number
   Write #number, "This is a sample."
Close #number

0
 

Author Comment

by:R_N_WARD
Comment Utility
Thank you.  A++.  Now could you tell me how to loud the data back to the textbox?
0
 
LVL 1

Expert Comment

by:pit_
Comment Utility
Pretty much the same way, except instead of opening the file for Output, open it for Input and use Input #ff, ...


ex.

Open strFileName For Input As ff
Input #ff, strData
Close

txtBox.Text = strData
0
 

Author Comment

by:R_N_WARD
Comment Utility
Thanks for all the help
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now