Valhalla Legends Archive

Programming => General Programming => Topic started by: Invincibility on May 21, 2003, 09:49 PM

Title: Need Some Help - Not Urgent -
Post by: 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 =)~
Title: Re:Need Some Help - Not Urgent -
Post by: Invincibility on May 21, 2003, 09:52 PM
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
Title: Re:Need Some Help - Not Urgent -
Post by: drivehappy on May 21, 2003, 10:03 PM
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
Title: Re:Need Some Help - Not Urgent -
Post by: Invincibility on May 21, 2003, 10:39 PM
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...
Title: Re:Need Some Help - Not Urgent -
Post by: drivehappy on May 21, 2003, 11:38 PM
What code do you have inside it though? If you just use that, it will of course not display anything.
Title: Re:Need Some Help - Not Urgent -
Post by: Invincibility on May 21, 2003, 11:59 PM
i do have just that, what do i need to add?
Title: Re:Need Some Help - Not Urgent -
Post by: drivehappy on May 23, 2003, 01:11 AM
Read the rest of that tutorial site you were at.
Title: Re:Need Some Help - Not Urgent -
Post by: MrRaza on May 23, 2003, 06:40 AM
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.
Title: Re:Need Some Help - Not Urgent -
Post by: Invincibility on May 27, 2003, 06:19 PM
ok so, it doesnt open the text file.
it doesnt print any letters into it....
what does it fricking do o.0
Title: Re:Need Some Help - Not Urgent -
Post by: Cy on May 28, 2003, 04:03 AM
Try Run?
Title: Re:Need Some Help - Not Urgent -
Post by: ______ on May 28, 2003, 09:06 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
Title: Re:Need Some Help - Not Urgent -
Post by: Grok on May 28, 2003, 10:25 AM
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