Valhalla Legends Forums Archive | General Programming | Need Some Help - Not Urgent -

AuthorMessageTime
Invincibility
OPEN "filename" for INPUT as #1
CLOSE #1
Doesnt open the "text" file i put in the {" "}, heh, just starting to learn =)~
May 22, 2003, 2:49 AM
Invincibility
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
May 22, 2003, 2:52 AM
drivehappy
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
May 22, 2003, 3:03 AM
Invincibility
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...
May 22, 2003, 3:39 AM
drivehappy
What code do you have inside it though? If you just use that, it will of course not display anything.
May 22, 2003, 4:38 AM
Invincibility
i do have just that, what do i need to add?
May 22, 2003, 4:59 AM
drivehappy
Read the rest of that tutorial site you were at.
May 23, 2003, 6:11 AM
MrRaza
[quote author=Invincibility link=board=5;threadid=1395;start=0#msg10393 date=1053571743]
OPEN "filename" for INPUT as #1
CLOSE #1
Doesnt open the "text" file i put in the {" "}, heh, just starting to learn =)~
[/quote]

[quote]Didnt input the letters "#1" if it was suppose to
[/quote]

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.
May 23, 2003, 11:40 AM
Invincibility
ok so, it doesnt open the text file.
it doesnt print any letters into it....
what does it fricking do o.0
May 27, 2003, 11:19 PM
Cy
Try Run?
May 28, 2003, 9:03 AM
______
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
May 28, 2003, 2:06 PM
Grok
Please use code tags around your source code so it is easy to read.

An alternative, using the Scripting library:
[code]
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
[/code]
May 28, 2003, 3:25 PM

Search