Local Image on a WebBrowser control

  • Thread starter Thread starter Zeno Loco
  • Start date Start date
Z

Zeno Loco

Hi,

I need to create an HTML page on a WebBrowser and insert there an
image stored in the device.
In the OnLoad event I use the following code :

Dim img As String = "\My Documents\WiSoul\Image1.jpg"
WebBrowser1.DocumentText = "<HTML><BODY>" + _
"<IMG SRC='" + img + "'>" + _
"</BODY></HTML>"

but the image is not found.
Any idea?

Thank's
Marcello
 
Thank's Nino ana Pete but the following modified code doesn't show the
image (only the aaa string and the image placeholder)

Dim img As String = "file://Programmi/wisoul/test.jpg"
Dim HTML As String = "<HTML><BODY><CENTER>aaa</CENTER><BR>" + _
"<IMG SRC='" + img + "' />" + _
"</BODY></HTML>"
WebBrowser1.DocumentText = HTML


Marcello
 
You need to include only one forward slash in the "file:/" definition, change
your code to the following then it should work:

Dim img As String = "file:/Programmi/wisoul/test.jpg"
Dim HTML As String = "<HTML><BODY><CENTER>aaa</CENTER><BR>" + _
"<IMG SRC='" + img + "' />" + _
"</BODY></HTML>"
WebBrowser1.DocumentText = HTML
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top