I am trying to insert a piece of html code into a web browser control in vb 2010. i have tried the webbrowser1.documenttext function but cant seem to get the browser to run the html code. can anyone help? thanks

Recommended Answers

All 7 Replies

Do you mean to run the links/buttons that you added to the .DocumentText?

Basically i want a webbrowser control to read a small piece of html code and then display the contents.

Read html code from where? A file? Your app.'s code lines?
Post html code sample that you want to display in your wb.

I want to read from my apps code lines. just something simple like

<head>
<p> hello World</p>
</head>

See if this helps.

Dim x As String =  "<p><img src=""http://www.freesmileys.org/smileys/smiley-happy114.gif"" alt="""" title=""www.freesmileys.org"" />Hello World</p>"
        x &= "<center>"
        x &= "<span style=""font-size:25px;font-weight:bolder;"">From </span>"
        x &= "<a href=""http://www.daniweb.com/""><img src=""http://images.daniweb.com/logo.gif"" align=""middle"" border=""0"" alt="""" title=""DaniWeb IT Discussion Community"" /></a>"
        x &= "<br /><br /><img src=""http://www.freesmileys.org/smileys/smiley-happy020.gif"" alt="""" title=""www.freesmileys.org"" />"
        x &= "<br /><img src=""http://www.freesmileys.org/smileys/smiley-happy110.gif"" alt="""" title=""www.freesmileys.org"" />"
        x &= "<br /><img src=""http://www.freesmileys.org/smileys/smiley-happy095.gif"" alt="""" title=""www.freesmileys.org"" />"
        x &= "</center>"
        WebBrowser1.DocumentText = x

Basically, you have to set a String and only set the .DocumentText of the wb(WebBrowser) once.

thanks that worked

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.