Modify text on web page from ActiveX control?
Is this possible? For example, I currently have a simple ASP page with a simple ActiveX control on it. Rather than put the label within the ActiveX control itself, I want the ActiveX control to update a label on the ASP page to show some text. Any example on how to reference the ASP texbox from within the ActiveX control would be appreciated.
Re: Modify text on web page from ActiveX control?
I have the same issue, i tried using variants but I couldn't solve anything with. Any help would be appreciated.
Thanks.
Re: Modify text on web page from ActiveX control?
WOW! Talk about coming back from the dead after exactly 2 years!
Re: Modify text on web page from ActiveX control?
Hi,
Yes ofcouse you can do that using MSHTML classes. Once you create an instance of the same you can use all the wast functionality of MSHTML and the best part is its majority of the classes and properties reseble to Java Script.
Below is a sample code to write on a textbox on HTML form from a ActiveX control embedded on the same.
Code:
' For Getting Handle of current Internet Browser
Dim objCurrBrowser As HTMLWindow2
' For Getting Handle of current HTML Document
Dim docobj As MSHTML.HTMLDocument
' For Getting Handle of desired HTML object
Dim stringDataField As IHTMLElement
Set objCurrBrowser = UserControl.Parent.Script.document.parentWindow
Set docobj = UserControl.Parent.Script.document
Set stringDataField = docobj.getElementById("txtTextBoxID")
If stringDataField Is Nothing Then
Exit Function
Else
If stringDataField.innerText = "This is a test !!"
End If