By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

Saving Data into a text file

P: 5
How would i save a list of names, lets say, and then when I go to the file bar and click Class 1. How would i get the names from the txt File into a text box or label?
Oct 30 '06 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
How would i save a list of names, lets say, and then when I go to the file bar and click Class 1. How would i get the names from the txt File into a text box or label?
Probably the simplest way is to use something like
Expand|Select|Wrap|Line Numbers
  1. Open "MyFile.txt" For Output Access Write Lock Read Write As #1
  2. Print #1, Count
  3. For I = 1 To Count
  4.   Print #1, Name(I)
  5. Next
  6. Close #1
Then to read them back in, you would do something like
Expand|Select|Wrap|Line Numbers
  1. Open "MyFile.txt" For Input Access Read Shared As #1
  2. Line Input #1,Count
  3. Redim Names(Count)
  4. For I = 1 To Count
  5.   Line Ipnut #1, Name(I)
  6. Next
  7. Close #1
This should help get you started, but of course I have made a lot of assumptions here.
Oct 30 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.