Solved

Setting value of an ActiveX control using PARAM

Posted on 1998-01-20
8
223 Views
Last Modified: 2009-07-29
I am creating a control using VB5. How do I expose a variable whose value can be set in the HTML <OBJECT> tag using <PARAM>?
0
Comment
Question by:janeb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 

Accepted Solution

by:
v923146 earned 50 total points
ID: 1452556
Here's an example of one I wrote:

<OBJECT ID="Label1" WIDTH=50 HEIGHT=20 NOTAB
 CLASSID="CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0">
                                                 <PARAM NAME="ForeColor" VALUE="<%=fColor%>">
<PARAM NAME="BackColor" VALUE="12632256">
<PARAM NAME="Caption" VALUE="<%=iUsage%>">
<PARAM NAME="Size" VALUE="2540;635">
<PARAM NAME="FontEffects" VALUE="1073741825">
<PARAM NAME="FontHeight" VALUE="280">
<PARAM NAME="FontCharSet" VALUE="0">
<PARAM NAME="FontPitchAndFamily" VALUE="2">
<PARAM NAME="ParagraphAlign" VALUE="3">
<PARAM NAME="FontWeight" VALUE="700">

</OBJECT>

Hope this helps.



0
 

Author Comment

by:janeb
ID: 1452557
Sorry if I did not ask my question clearly !!
I know about the HTML part, I was actually asking how to expose the variable inside the VB5 codes of the control.
Hope this is clearer. Thanks!!
0
 

Expert Comment

by:v923146
ID: 1452558
Make the variable a property of the control using Property Get and Property Let statements.  Then you'll be able to use it in the Param Name same as the others.

Syntax for Get

[Public | Private | Friend] [Static] Property Get name [(arglist)] [As type]
      [statements]
      [name = expression]
      [Exit Property]
      [statements]
      [name = expression]
End Property

Syntax for property Let

[Public | Private | Friend] [Static] Property Let name ([arglist,] value)
      [statements]
      [Exit Property]
      [statements]
End Property

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Expert Comment

by:v923146
ID: 1452559
Make the variable a property of the control using Property Get and Property Let statements.  Then you'll be able to use it in the Param Name same as the others.

Syntax for Get

[Public | Private | Friend] [Static] Property Get name [(arglist)] [As type]
      [statements]
      [name = expression]
      [Exit Property]
      [statements]
      [name = expression]
End Property

Syntax for property Let

[Public | Private | Friend] [Static] Property Let name ([arglist,] value)
      [statements]
      [Exit Property]
      [statements]
End Property

0
 

Author Comment

by:janeb
ID: 1452560
Hi thanks for the help.
But I tried it with no success, I did it like this:

In the General Declaration of VB5, I declare:
Private m_Value as Integer

In Property Let and Get:
Public Property Get My_Value() As Integer
    My_Value= m_Value
End Property

Public Property Let login_type(ByVal New_Value As Integer)
    m_Value = New_Value
End Property

In UserControl_Initialize of VB5, I use My_Value somewhere like this:
If My_Value = 1 Then.....

In HTML, I try to set My_Value in two ways like this:
( Using PARAM NAME )
<OBJECT ID="MyControl" .....>
<PARAM NAME="My_Value" VALUE="1">
</OBJECT>

( Using VBScript )
<HTML>
<HEAD>
Sub Window_onLoad()
   MyControl.My_Value = 1
End Sub
</Head>
...

When I run the control on my browser, the value of My_Value never gets set as 1, it remains as 0.
Would appreciate if you can tell me where I have gone wrong. Thanks !!!!

0
 

Author Comment

by:janeb
ID: 1452561
Sorry, in case it matters,
the last part on VBScript shd be:
( Using VBScript )
<HTML>
<HEAD>
<Script Language="VBScript">
<!--
Sub Window_onLoad()
   MyControl.My_Value = 1
End Sub
-->
</Script>
</Head>
...

Thanks!
0
 

Expert Comment

by:v923146
ID: 1452562
Try this:

In the General Declaration of VB5, declare:
Private m_Value as Integer

In Property Let and Get:
Public Property Get My_Value() As Integer
 My_Value= m_Value
End Property

Public Property Let My_Value(ByVal vsMyValue As Integer)
  m_Value = vsMyValue
End Property

You have the HTML for the object right.  Let me know how this works out.
0
 

Author Comment

by:janeb
ID: 1452563
Yup it works. Thanks!!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question