|
-
Dec 5th, 2008, 10:59 AM
#1
Thread Starter
Junior Member
[RESOLVED] [2005] Listing remote Directory
Hi.. I'm new to visual basic, I'm now making a program to list files in remote directory, currently I'm using php to generate text file and my program to read the text file
I want to read file line by line from http://localhost/tes/view.txt
but it got stuck at this code
Code:
Dim objReader As New StreamReader("http://localhost/tes/view.txt")
It said URI format not supported.. How to make it support? Is there some way to read remote file text?
or is there some other way yo read files in directory?
Thanks..
-
Dec 5th, 2008, 11:13 AM
#2
Re: [2005] Listing remote Directory
You need to use a WebClient to download that file, then read it using streamreader. Something like this:
Code:
Using WC As New System.Net.WebClient()
Dim strem As IO.Stream = WC.OpenRead("put the address here")
Using reader As New System.IO.StreamReader(strem)
Dim line As String = String.Empty
While reader.Peek >= 0
line = reader.ReadLine()
'Do whatever you want with that line here
'
End While
End Using
End Using
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Dec 6th, 2008, 01:17 PM
#3
Thread Starter
Junior Member
Re: [2005] Listing remote Directory
 Originally Posted by stanav
You need to use a WebClient to download that file, then read it using streamreader. Something like this:
Code:
Using WC As New System.Net.WebClient()
Dim strem As IO.Stream = WC.OpenRead("put the address here")
Using reader As New System.IO.StreamReader(strem)
Dim line As String = String.Empty
While reader.Peek >= 0
line = reader.ReadLine()
'Do whatever you want with that line here
'
End While
End Using
End Using
Thanks a lot it's working..
-
Dec 26th, 2008, 04:34 PM
#4
New Member
Re: [RESOLVED] [2005] Listing remote Directory
Hi LeonLanford,
you said you were trying to list remote directory with vb.net. I'm trying to do that but I haven´t found the way. Did you get it?
Thanks
-
Dec 26th, 2008, 08:34 PM
#5
Thread Starter
Junior Member
Re: [RESOLVED] [2005] Listing remote Directory
I'm using php to generate file about the files and directory there and read the generated file..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|