hawk1ns Posted February 3, 2004 Posted February 3, 2004 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 Quote
Leaders dynamic_sysop Posted February 3, 2004 Leaders Posted February 3, 2004 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^^^ Quote
hawk1ns Posted February 4, 2004 Author Posted February 4, 2004 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 Quote
Leaders dynamic_sysop Posted February 5, 2004 Leaders Posted February 5, 2004 you must have the webbrowser named " AxWebBrowser1 " , also you must navigate to either a blank page or a valid website otherwise the webbrowser wont have a Document. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.