Load .jpg in webbrowser control

Does anyone know how to load a .jpg file into a webbrowser, from a local file on the hard disk?

This doesn't work:

WebBrowser2.Navigate ("C:\image.jpg")

But, I can go to regular Internet Explorer and type "C:\image.jpg" in the address bar and it comes up fine.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WebBrowser2.Navigate ("file://c|/image.jpg")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hrolsonsAuthor Commented:
Didn't work for me.

I'm going to shut down firewall & anti-virus to rule that out.
hrolsonsAuthor Commented:
Still not working.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:

    WebBrowser2.Navigate "file://C:\image.jpg"
hrolsonsAuthor Commented:
No luck:

Navigation to the webpage was canceled
I've tried it myself and for me,

WebBrowser2.Navigate "file://C:/image.jpg"

worked. Little odd and non-conforming but hey, it's MS.
hrolsonsAuthor Commented:
Fortunately, it's not vital to my project(would be nice though), but I can't get it to work trying all of the conventions above.
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
What if you try to load it this way?

        Dim html As String
        html = "<img src=" & Chr(34) & "file://localhost/C:/Users/Mike/Pictures/AmericanFlag.jpg" & Chr(34) & " align=" & Chr(34) & "center" & Chr(34) & "/>"
        WebBrowser1.DocumentText = html
hrolsonsAuthor Commented:
"Object doesn't support this property or method"
hrolsonsAuthor Commented:
Interesting, out of frustration, I moved the file from it's long path to C:\image.jpg and it worked.  So then I thought it might be a backslash,forward slash issue.  But it actually turned out to be the fact that my W: drive is a mapped drive to my web server.  Not sure why it doesn't like it, but that's a different subject all together.
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Sorry...I'm working in VB.Net...try this:
Dim html As String
html = "<img src=" & Chr(34) & "file://localhost/C:/Users/Mike/Pictures/AmericanFlag.jpg" & Chr(34) & " align=" & Chr(34) & "center" & Chr(34) & "/>"
WebBrowser1.Navigate "about:blank"
While (WebBrowser1.Document Is Nothing)
With WebBrowser1.Document
   .Write html
End With

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.