Interaction between VBScript and ActiveX Control
Posted
by Chan Komagan
on October 13th, 2003
If you have a method in ActiveX Control which takes a Variant array to initiate the control for some purpose. Use this easy tip.
Step 1 :
In the ActiveX control say we have a function called AssignControlValues which takes the array of Variant values Declare the function like the following
Public Function AssignControlValues _
(controlvalues As Variant)
dim controlarray as variant
dim maxvalues as integer
maxvalues = UBound(controlvalues)
redim controlarray(maxvalues)
for i=0 to maxvalues
controlarray(i)=controlvalues(i)
next i
End function
Step 2 :
At the VBScript side
Declare the object
<object classid="CLSID:XXXX" _
CODEBASE="http://vbsource/object.CAB#Version=2,0,0,0
id="Object1>
We can call the method in the ActiveX control from the VBScript using the Object ID just declared above
<script language="vbscript">
dim controlvalues
controlvalues(0)=text1.text ' Assign values to the control array
controlvalues(1)=combo1.text ' Either u get it from the HTML
' Controls or anything else
controlvalues(2)=text3.text
controlvalues(3)=list1.name
controlvalues(4)=text1.text
call Object1.AssignControlValues controlvalues ' pass the array
' as variant
' object
</script>
This way the user can pass the entire array with a single method call instead of passing with the ActiveX
property.
This is very usefull for the interaction between VBScript and ActiveX Control.
Note : The method of object could be called with the values of elements in the ActiveX control also.

Comments
Syntans
Posted by ZsiviraIndia on 11/19/2012 03:23amsyntans manufacturers in india. Syntans are used for retanning of leather processing to produce leathers.
ReplyProperties are missing at ASP
Posted by Legacy on 09/09/2003 12:00amOriginally posted by: dwarakanadh
Hi,
Replythis is dwarakanadh, i am finding difficulty regarding ocx control, any help is thankful.
Problem Description:
I created a ocx control, which it has only two text boxes. i want my control should have only one property that is "text" property of the one text box. i created property named "text" and delegated the text1.text property to that property.
i was able to work with this ocx fine in VB.
when i place this ocx control in asp page, i am finding that property listed under "Nil" category, because of that i am not able to use that property.
any suggestions or solution is very thankful,
regards,
dwaraka.
arrays problem
Posted by Legacy on 12/13/2002 12:00amOriginally posted by: rajesh
te code is designed for problem as i cannot pass array to control error in asp page run time error mail me the solution
ReplyMade easy fro the others
Posted by Legacy on 11/28/2002 12:00amOriginally posted by: Peder Larsen
ReplyPassing params
Posted by Legacy on 10/18/2002 12:00amOriginally posted by: Domingos
Hi!
can i use the tag <param name="x1" value="value1">?
how can i get the value in visual basic of th "x1 passed"?
what are the declaration i must have?
Thanks for your time
Replyhow to use this coe? i has problem.
Posted by Legacy on 12/02/2001 12:00amOriginally posted by: linn
ReplyInteraction between VBScript and ActiveX Control
Posted by Legacy on 10/30/2001 12:00amOriginally posted by: jembong
In the code
----------------------------
object classid="CLSID:XXXX" CODEBASE=
----------------------------
Do you have to Register the OCX or not?
What is CODEBASE?
How can I use CODEBASE in an intranet application?
Replycode problem
Posted by Legacy on 08/18/2001 12:00amOriginally posted by: preethy
i want to know the object code for commomdialog box.
<object classid="CLSID:XXXX" CODEBASE="">
i want to know the correct syntax of this <OBJECT> tag and hte classid for commondialog.
that is the full syntan.
if possible please write back to me
Replybye