WebClient.OpenRead : WebClient « System.Net « VB.Net by API






WebClient.OpenRead

  

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

   
    
  








Related examples in the same category

1.WebClient.DownloadData
2.WebClient.DownloadFile