Invalid access to memory location

1

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

c#
winforms
asked on Stack Overflow May 9, 2013 by Muhammad Omair • edited May 9, 2013 by Agustin Meriles

2 Answers

0

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.

answered on Stack Overflow May 9, 2013 by Arshad • edited May 9, 2013 by Arshad
-1

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.

answered on Stack Overflow May 9, 2013 by canhazbits • edited May 9, 2013 by canhazbits

User contributions licensed under CC BY-SA 3.0