Results 1 to 3 of 3

Thread: accessing param value in activeX Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Posts
    2
    Hi,

    I am a newbie to activeX Controls and have a question about passing "PARAM" from HTML page to an
    activeX control.
    I am trying to pass parameters from HTML page onto an activeX Control using "PARAM NAME="" VALUE="".but am having problems with accessing the param value inside the activeX Control.

    activeX.html
    ---------------
    <OBJECT CODEBASE=/Project1.ocx
    CLASSID="...."
    <PARAM NAME="test" VALUE="100">
    </OBJECT>

    In my UserControl1.ctl how do i access the value of the param "TEST"

    In my activeX Control(UserControl1.ctl) I am using get() and set() methods as:

    Private mtest As String

    Property Get test() As String
    ' Use the Set statement for object references.
    test = mtest
    End Property

    Public Property Set test(NewParent)
    mtest = NewParent
    End Property

    Private Sub myButton_Click()
    Print ("mtest=" + mtest)
    End Sub

    But, when I run it and click on the button it doesn't display anything for mtest.

    Can someone please help me with this??

    thanks a lot.

  2. #2
    New Member
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    4
    hi

    I have now the same problem as you.
    When you could solve the problem, it woud be nice if
    you can help me

    thanks

    gerd

  3. #3
    Fanatic Member Slaine's Avatar
    Join Date
    Jul 2002
    Posts
    641
    You also need to implement the code to get the PARAM details from the HTML page when the control first loads. This is done using a Property Bag (A stupid name I know but blame Microsoft).

    Try adding the following to your code.

    Code:
    Private mTest as String
    Const m_defaultTest = ""
    
    Private Sub UserControl_InitProperties()
        mTest = m_defaultTest 
    End Sub
    
    'Load property values from storage
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        mTest = PropBag.ReadProperty("Test", defaultTest)
    End Sub
    
    'Write property values to storage
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        Call PropBag.WriteProperty("Test", mTest, defaultTest)
    End Sub
    
    Property Get test() As String 
        test = mTest 
    End Property 
    
    Public Property Let test(NewValue as String) 
        mTest = NewValue
    End Property 
    
    Private Sub myButton_Click() 
        Print ("mtest=" + mtest) 
    End Sub
    I've not tested the above so you may find a few bugs but let me know how you get on.
    Martin J Wallace (Slaine)

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