Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim icon As Icon icon = GetWebSiteIcon("http://www.google.co.jp") If icon IsNot Nothing Then Me.Icon = icon Else Me.Icon = Nothing End If End Sub Private Function GetWebSiteIcon(ByVal url As String) As Icon Dim icon As Icon Dim webpage As System.Net.HttpWebRequest = Net.WebRequest.Create(url & "/favicon.ico") Dim response As System.Net.WebResponse Try response = webpage.GetResponse() Catch ex As Net.WebException ' End Try If response IsNot Nothing AndAlso response.ContentType.ToUpper.StartsWith("IMAGE/") Then 'ルートディレクトリにfavicon.icoがある場合 Dim iconFolderName As String = Application.StartupPath & "\icon" If IO.Directory.Exists(iconFolderName) = False Then IO.Directory.CreateDirectory(iconFolderName) End If Dim iconFileFullPath As String = iconFolderName & "\temp.ico" Dim reader As New IO.BinaryReader(response.GetResponseStream) IO.File.WriteAllBytes(iconFileFullPath, reader.ReadBytes(response.ContentLength)) reader.Close() icon = New Icon(iconFileFullPath) Else 'その他の場合(未実装) End If response.Close() Return icon End Function