Jump to content
Xtreme .Net Talk

how to : copy html from a textbox and display as page in axwebbrowser


Recommended Posts

Posted

can someone please explain how to copy html from a textbox and display as page in axwebbrowser.

 

I would like to be able to type in html into a textbox set at multiline and then click a button and have this html display as a webpage in the axwebbrowser window ?

 

any suggestions ?

 

Kind Regards

Carl

  • Leaders
Posted

oops posted it in the wrong message before :rolleyes:

like this...

       AxWebBrowser1.Navigate("about:blank")
       While AxWebBrowser1.Busy
           Application.DoEvents()
       End While

       Dim objHtml As Object() = {TextBox1.Text}
       AxWebBrowser1.Document.GetType.InvokeMember("open", Reflection.BindingFlags.InvokeMethod, Nothing, AxWebBrowser1.Document, Nothing)
       '/// open the document for writing ^^^
       AxWebBrowser1.Document.GetType.InvokeMember("write", Reflection.BindingFlags.InvokeMethod, Nothing, AxWebBrowser1.Document, objHtml)
       '/// write the text^^^
       AxWebBrowser1.Document.GetType.InvokeMember("close", Reflection.BindingFlags.InvokeMethod, Nothing, AxWebBrowser1.Document, Nothing)
       '/// close the document^^^

Posted

thanks for that :)

 

Thankyou .

 

However i seemed to get an error with this , the code looks ok and theres no apparent errors , and also runs ok , but when i click the button i get this error :

 

An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication7.exe

 

Additional information: Object reference not set to an instance of an object.

 

and highlights this line

 

AxWebBrowser1.Document.GetType.InvokeMember("open", Reflection.BindingFlags.InvokeMethod, Nothing, AxWebBrowser1.Document, Nothing)

 

Kind Regards

Carl

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...