Solved

Saving Data to disk

Posted on 2000-03-06
5
142 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
ID: 2588684
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
ID: 2588709
'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
ID: 2588712
Thank you.  A++.  Now could you tell me how to loud the data back to the textbox?
0
 
LVL 1

Expert Comment

by:pit_
ID: 2588730
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
ID: 2588746
Thanks for all the help
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

821 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