?
Solved

read a string from ".txt"

Posted on 2003-03-27
4
Medium Priority
?
172 Views
Last Modified: 2010-05-01
i need to read a string from a txt file.
and i need to update that file with a new string
how i can?
0
Comment
Question by:methhh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:methhh
ID: 8221395
thanks =) !!
0
 
LVL 1

Accepted Solution

by:
dmstrat earned 400 total points
ID: 8221499
Can you explain more of what you are trying to accomplish.  It can really help with your answer.

If you are trying to simply keep information for your program you should really use the "SaveSetting" feature to save to the Registry.  This would allow for you to save that information over and over and make changes without having to use the FileSystemObject.

Here is a link on how to do that.

http://www.developerfusion.com/show/44/2/

If you HAVE to work with this file instead of the registry save, you can use the FileSystemObject with the TextStream Object (both searchable on microsoft.com).  

You would make a simple FileSystemObject and then open the file.  This opening becomes a TextStream object and you have a method called "readline" that should give you the information you need.  You also have a "writeline" method that can put the new information in that you need to save.

Hope this helps.
0
 
LVL 5

Expert Comment

by:YaakovS
ID: 8221656
I’m not sure what exactly you are trying to do, you can read a txt file using the Input command (I don’t know why but I’m assuming it’s a comma delimited) example:

Open app.path & “\whateveryourfileiscalled” for input as #1
Do while not eof(1)
     Input #1 strone, strtwo…

Loop
Then to write just open the file for output or if you want to add to it open it for append.
0
 

Author Comment

by:methhh
ID: 8221931
thanks dmstrat!!! =)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

771 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