Select the product you need help with
How to use Visual C# to call a VBScript function on a Web page that is loaded in an ActiveX WebBrowser control in a Windows Forms applicationArticle ID: 922275 - View products that this article applies to. On This PageINTRODUCTIONThis article describes how to use Microsoft Visual C# to call a Microsoft Visual Basic Scripting Edition (VBScript) function on a Web page. Specifically, the Web page is loaded in an ActiveX WebBrowser control in a Windows Forms application. To perform the procedures in the "More Information" section, you must already have the following items:
http://msdn2.microsoft.com/en-us/library/2te2y1x6.aspx
(http://msdn2.microsoft.com/en-us/library/2te2y1x6.aspx)
MORE INFORMATIONThe following procedures demonstrate how to call a VBScript function on a Web page that is loaded in an ActiveX WebBrowser control. Add a reference to the Microsoft HTML Object Library (Mshtml.tlb)Before you can call a VBScript function in an ActiveX WebBrowser control from a Windows Forms application, you must add a reference to the Microsoft HTML Object Library. To do this, follow these steps:
Add a method that calls the VBScript functionAfter you add a reference to the Microsoft HTML Object Library, you can add a method that calls a VBScript function on a Web page that is loaded in an ActiveX WebBrowser control.The following code sample demonstrates how to call a VBScript function on a Web page that is loaded in an ActiveX WebBrowser control. This code sample uses the IHTMLDocument.Script property in the Microsoft HTML Object Library to obtain access to the scripting object. The code sample then uses the InvokeMember method to call the VBScript function. Note Replace axWebBrowser1 in the following code with the name of the ActiveX WebBrowser control instance that occurs in your application. Note The VBScript function is named myVBScriptFunction. REFERENCESFor more information about the ActiveX WebBrowser control, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/Aa752040.aspx
(http://msdn2.microsoft.com/en-us/library/Aa752040.aspx)
Properties |


Back to the top








