Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read a string from a file and write it to a variable!

Status
Not open for further replies.

Gti

Programmer
Jul 23, 2001
99
PT
I have a file, i need to open it and read the first string to to a variable. How can i do this?
 
Try reading about the FileSystemObject in the Help for VB. The many properties and methods will handle everything you are looking for.
 
I dont know how to do that... can you help me´?
 
Open up a project in VB6. Click on the Help menu and choose the Search menu item. In the Search textbox type in 'Visual Basic FileSystemObject' (without the quotes) and click on List Topics. This will bring up a list of items to do with FileSystemObject in VB. Click on a topic to show it.

A good place to start would be:

HOWTO: Use FileSystemObject with Visual Basic

Happy reading!
 
Code:
Dim MyString As String

Open ("C:\Temp\YourFile.txt") For Input As #1
    Input #1, MyString    'Or Line Input
Close #1

MsgBox MyString
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top