VB.Net Tutorial/Socket Network/WebClient
Версия от 19:40, 26 мая 2010; (обсуждение)
Create a StreamReader from a WebClient
<source lang="vbnet">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.vbex.ru") Dim myStreamReader As New StreamReader(myStream) Console.WriteLine(myStreamReader.ReadToEnd) Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub
End Class</source>
<HTML> <HEAD> Java examples (example source code) Organized by topic </title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content -style-type" content="text/css"/> <meta name="author" content="Demo Source and Support Ltd."/> <meta name="copyright" content="2006 Demo Source and Support Ltd."/> ... ...
Save a web page to a file
<source lang="vbnet">Imports System.Net Imports System.IO Imports System.Text
Public Class Tester
Public Shared Sub Main Dim myWebClient As New WebClient() Dim mybyte() As Byte mybyte = myWebClient.DownloadData("http://www.vbex.ru") myWebClient.DownloadFile("http://www.vbex.ru", "test.txt")
End Sub
End Class</source>