Favicon help?

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
24 posts Page 1 of 3
User avatar
dj1437
VIP - Donator
VIP - Donator
Posts: 504
Joined: Tue Dec 21, 2010 2:02 am

Favicon help?
dj1437
Hey guys,
I was recently working on Webquest, and I was wondering, when the browser finishes loading the document, how would i be able to make the websites favicon become the forms icon? Thanks!
This is a signature.
User avatar
clanc789
Coding Guru
Coding Guru
Posts: 786
Joined: Tue Nov 02, 2010 4:45 pm

Re: Favicon help?
clanc789
You could try the getelemenetbyid functoin? I dont know much about this really but give it a try.
Practice makes perfect!

VIP since: 6-10-2011
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: Favicon help?
comathi
You might be able to tweak this a bit:
Code: Select all
        Dim iconURL = "http://www.microsoft.com/favicon.ico"
        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 mimage = Image.FromStream(stream)
        Me.ToolStripLabel1.Image = mimage
 
Taken from http://social.msdn.microsoft.com/Forums ... 12b1cbc317
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: Favicon help?
Skillful
A bit tweaked version of Comathi :P
Code: Select all
Dim iconURL = "http://" + txtURL.Text +"/favicon.ico"
        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 mimage = Image.FromStream(stream)
        Me.PictureBox1.Image = mimage
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
dj1437
VIP - Donator
VIP - Donator
Posts: 504
Joined: Tue Dec 21, 2010 2:02 am

Re: Favicon help?
dj1437
I have used those codes provided, but I still cant find out how to fix my problem. Please help!!! :(
This is a signature.
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Favicon help?
Usman55
Tell us how the text is displayed in your textbox. I'd send you the working code but I'm not on my computer now.
Image
User avatar
Download
Just Registered
Just Registered
Posts: 9
Joined: Sun May 27, 2012 9:56 pm

Re: Favicon help?
Download
Code: Select all
Dim iconURL = Webbrowser1.Url.Tostring + "/favicon.ico"
        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 mimage = Image.FromStream(stream)
        Me.PictureBox1.Image = mimage
this should work
From,
Image
----Download----
User avatar
Martin
Supreme VIP
Supreme VIP
Posts: 369
Joined: Sat Aug 01, 2009 12:26 pm

Re: Favicon help?
Martin
A bit tweaked version of Skillful :P
Code: Select all
Dim iconURL = "http://" + txtURL.Text +"/favicon.ico"
        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 mimage = Image.FromStream(stream)
        Me.PictureBox1.Image = mimage
        Msgbox("Done")
Image
Vikhedgehog
VIP - Donator
VIP - Donator
Posts: 812
Joined: Fri Nov 05, 2010 6:24 pm

Re: Favicon help?
Vikhedgehog
A bit tweaked version of Martin :P
Code: Select all
Dim iconURL = "http://" + txtURL.Text +"/favicon.ico"
        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 mimage = Image.FromStream(stream)
        Me.PictureBox1.Image = mimage
        Msgbox("Done! Yay!")
User avatar
Download
Just Registered
Just Registered
Posts: 9
Joined: Sun May 27, 2012 9:56 pm

Re: Favicon help?
Download
A bit tweaked version of Vikhedgehog's
Code: Select all
Dim iconURL = webbrowser1.url.tostring +"/favicon.ico"
        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 iconimage = Image.FromStream(stream)
        PictureBox1.Image = iconimage
        Msgbox("Loading Done")
From,
Image
----Download----
24 posts Page 1 of 3
Return to “Coding Help & Support”