My code is looks like this:
WebBrowser browser = new WebBrowser();
browser.Width = 700;
browser.Height = 200;
**browser.Url = new Uri("about:blank");**
browser.DocumentText = mytext;
and the error occurred in highlighted line ie:
BadImageFormatException was unhandled: Invalid access to memory location. (Exception from HRESULT: 0x800703E6).
I have search in many forums and already change my Project Property Platform to Any CPU. But its not works.
Any help will be appreciated.
Thanks
You can try this :
WebBrowser webBrowser1 = new WebBrowser();
webBrowser1.Navigate("about:blank");
HtmlDocument objHtmlDoc = webBrowser1.Document;
objHtmlDoc.Write("<span style=\"font-size:10px\">TEXT </span>");
panel1.Controls.Add(webBrowser1);
This is working fine for me.
BadImageFormatException is often related to bitness - try changing the architecture (x86, x64) of your product's build to match that of the DLLs you are referencing.
User contributions licensed under CC BY-SA 3.0