can someone tell me how to get the icon of a webpage. i can get the icon of a webpage and set it as an image but i want to take it and set it as the icon for my application. here is the code to get the icon and set it as a image

Dim url As Uri = New Uri(TextBox1.Text)

            If url.HostNameType = UriHostNameType.Dns Then
                ' Get the URL of the favicon
                ' url.Host will return such string as www.google.com
                Dim iconURL = "http://" & url.Host & "/favicon.ico"
                ' Download the favicon
                Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL)
                Dim response As System.Net.HttpWebResponse = request.GetResponse()
                Dim stream As System.IO.Stream = response.GetResponseStream()
                Dim favicon = Image.FromStream(stream)
                ' Display the favicon on PictureBox1
                PictureBox1.Image = favicon
            End If

try this
Icon = New Icon(stream)

ok i tried

dim favicon = icon.fromstream(stream)

mabye that will work

sorry did'nt work

Add this to your code.

Dim iconBitmap As Bitmap = New Bitmap(favicon)
            Me.Icon = Icon.FromHandle(iconBitmap.GetHicon)

thanks again codeorder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.