942,967 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 504
  • VB.NET RSS
Sep 8th, 2010
0

get icon of webpage

Expand Post »
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
VB.NET Syntax (Toggle Plain Text)
  1. Dim url As Uri = New Uri(TextBox1.Text)
  2.  
  3. If url.HostNameType = UriHostNameType.Dns Then
  4. ' Get the URL of the favicon
  5. ' url.Host will return such string as www.google.com
  6. Dim iconURL = "http://" & url.Host & "/favicon.ico"
  7. ' Download the favicon
  8. Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL)
  9. Dim response As System.Net.HttpWebResponse = request.GetResponse()
  10. Dim stream As System.IO.Stream = response.GetResponseStream()
  11. Dim favicon = Image.FromStream(stream)
  12. ' Display the favicon on PictureBox1
  13. PictureBox1.Image = favicon
  14. End If
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
choover12 is offline Offline
22 posts
since Sep 2010
Sep 8th, 2010
0
Re: get icon of webpage
try this
Icon = New Icon(stream)
Reputation Points: 10
Solved Threads: 8
Light Poster
ÜnLoCo is offline Offline
40 posts
since Dec 2009
Sep 9th, 2010
0
Re: get icon of webpage
ok i tried
VB.NET Syntax (Toggle Plain Text)
  1. dim favicon = icon.fromstream(stream)
mabye that will work
Reputation Points: 10
Solved Threads: 0
Newbie Poster
choover12 is offline Offline
22 posts
since Sep 2010
Sep 9th, 2010
0
Re: get icon of webpage
sorry did'nt work
Reputation Points: 10
Solved Threads: 0
Newbie Poster
choover12 is offline Offline
22 posts
since Sep 2010
Sep 9th, 2010
0
Re: get icon of webpage
Add this to your code.
VB.NET Syntax (Toggle Plain Text)
  1. Dim iconBitmap As Bitmap = New Bitmap(favicon)
  2. Me.Icon = Icon.FromHandle(iconBitmap.GetHicon)
Reputation Points: 234
Solved Threads: 358
Nearly a Posting Virtuoso
codeorder is offline Offline
1,382 posts
since Aug 2010
Sep 9th, 2010
0
Re: get icon of webpage
thanks again codeorder.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
choover12 is offline Offline
22 posts
since Sep 2010

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: UPDATE and DELETE issue
Next Thread in VB.NET Forum Timeline: vb.net POST





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC