Results 1 to 4 of 4

Thread: Modify text on web page from ActiveX control?

Hybrid View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091

    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.

    Visual Studio 2010

  2. #2
    New Member
    Join Date
    Aug 2008
    Posts
    1

    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.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091

    Re: Modify text on web page from ActiveX control?

    WOW! Talk about coming back from the dead after exactly 2 years!

    Visual Studio 2010

  4. #4
    New Member
    Join Date
    Sep 2008
    Posts
    1

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width