OPEN "filename" for INPUT as #1
CLOSE #1
Doesnt open the "text" file i put in the {" "}, heh, just starting to learn =)~
also {since i didnt see an "edit" command}
i tried doing the exact directory {C:\ etc. etc.}
Also Putting The .Exe in the same folder and just doing the name.txt
tried 1000 things =\~
http://www.vbinformation.com/tut-file.htm where im learning
Input reads from the file, so first off make sure that the file exists. This should work if you were to have a file called test.txt in your C drive.
Open "C:\test.txt" for Input as #1
Close #1
k well, make the file, altered the programming, still nothing
Didnt input the letters "#1" if it was suppose to
and it didnt open the file,
didnt do anything
P.S. im using a command button i will now try just putting it into the program...
What code do you have inside it though? If you just use that, it will of course not display anything.
i do have just that, what do i need to add?
Read the rest of that tutorial site you were at.
Quote from: Invincibility on May 21, 2003, 09:49 PM
OPEN "filename" for INPUT as #1
CLOSE #1
Doesnt open the "text" file i put in the {" "}, heh, just starting to learn =)~
QuoteDidnt input the letters "#1" if it was suppose to
i also believe that the #1 represents the File number you've given to the file, and it wont print #1's to the txt file anyway. PM me if you want more information.
ok so, it doesnt open the text file.
it doesnt print any letters into it....
what does it fricking do o.0
Try Run?
of course it doesnt print letters into it you didnt assign anything to be printed to the txt document
OPEN "filename" for INPUT as #1
CLOSE #1
will just open it and close it right away
dim TextLine as string
Open (App.Path & "\new.txt") For Input As #1
Do While Not EOF(1) ' EOF means end of file
Line Input #1, TextLine
If TextLine <> LineToRem Then
listbox.AddItem TextLine
End If
Loop
Close 1
that is how to get a file that has text in it and put it into a listbox
Please use code tags around your source code so it is easy to read.
An alternative, using the Scripting library:
Dim fso As New Scripting.FileSystemObject
Dim ts As Scripting.TextStream
Set ts = fso.OpenTextFile(fso.BuildPath(App.Path, "new.txt"), ForReading, False, TristateFalse)
Do While Not ts.AtEndOfStream
List1.AddItem ts.ReadLine
Loop