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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When loading form textfile becomes empty

Status
Not open for further replies.

HydraNL

Technical User
May 9, 2005
74
NL
Hi,

When I'm trying to read the contents of a textfile when opening a form it clears the content. Anyone knows what could be the problem?
Code:
Private Sub Form_Load()
Dim TempStr as String
   Open "C:\text.txt" For Output as #1
   Line Input #1, TempStr
   Label1.Caption = TempStr
   Close #1
End Sub
 
You need to open it For Input. For Output means that you are going to write to the file and opening it clears the file.
 
Ooow.... That was stupid. Perhaps I should take some rest. Thanks for the tip.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top