Solved

Setting value of an ActiveX control using PARAM

Posted on 1998-01-20
8
197 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

930 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now