Create a StreamReader from a WebClient : WebClient « Socket Network « VB.Net Tutorial






Imports System.Net
Imports System.IO
Imports System.Text


Public Class Tester
    Public Shared Sub Main
        Dim myWebClient As New WebClient()
        Dim myStream As Stream
        Dim myByte() As Byte

        Try
            myWebClient = New WebClient()
            myStream = myWebClient.OpenRead("http://www.java2s.com")
            Dim myStreamReader As New StreamReader(myStream)

            Console.WriteLine(myStreamReader.ReadToEnd)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try

    End Sub
End Class


     Java examples (example source code) Organized by topic 
        
    
    
...
...








22.29.WebClient
22.29.1.Save a web page to a file
22.29.2.Create a StreamReader from a WebClient