Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
VB
Dim FileNumber As Integer = 1
        Dim FileName As String = "C:\Users\TestFile.txt"
        FileOpen(1, FileName, OpenMode.Input)
        While Not EOF(1)
            Console.WriteLine(InputString(1, 1))
        End While
        FileClose(1)


I dont know what's wrong with this code, its could not read my file anyone could help
I want this code to read my TestFile.txt
Posted

You are not even trying to read anything. With text files, use System.IO.StreamReader with the methods ReadLine or ReadAllLines:
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx[^].

And could you explain: why would you ignore the answer to your previous question? This question is technically not quite a re-post, but somewhat redundant.

—SA
 
Share this answer
 
Comments
Thanks7872 13-Sep-13 1:40am    
+5. Ofcourse this is repost.
Sergey Alexandrovich Kryukov 13-Sep-13 1:42am    
Whatever... :-)
Thank you, Rohan.
—SA
VB
Dim Reader As System.IO.StreamReader
dim s as string
            Reader = New System.IO.StreamReader("C:\<pre lang="xml">Users\TestFile.txt&quot;) &#39;&lt;-- where to read from
            &#39;Dim tempstring As String
            &#39; Do
            s = Reader.ReadLine()</pre>


this code is helpful for you

if you have any about this please reply me........
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900