Solved

Setting value of an ActiveX control using PARAM

Posted on 1998-01-20
8
194 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…

760 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

21 Experts available now in Live!

Get 1:1 Help Now