Click to See Complete Forum and Search --> : VBScript control arrays


series0
August 22nd, 2002, 11:17 AM
I am trying to figure out how to add a control array to an asp page. I want the array defined in the DHTML code as, say, an array of edit boxes on the page that I can refer to via a code loop in the vbscript connected to the page. I have tried naming the controls the same name ( per vb-like paradigm ) and that doesnt work. What do I need to do?

I tried :

<TD>
<OBJECT id=Foo ...></OBJECT>
</TD>
<TD>
<OBJECT id=Foo ...></OBJECT>
</TD>

<SCRIPT ...>

...

for i = 0 to ubound( Foo )
Foo(i) = x(i)
next
</SCRIPT>

It does not work. How can I get a control array in vbscript?

goddess_spanky
August 22nd, 2002, 11:28 AM
A couple of questions to clarify:
1. What exactly is not working?
2. What error message are you receiving?
3. What type of control (text box, drop-down list, etc) are you using?
4. What are you trying to accomplish with the control array?

Maybe you can post more of your VBScript code or send me your page to help, but it seems like whatever the OBJECT is, it doesn't like control arrays.

series0
August 22nd, 2002, 11:54 AM
1. The attempt at making a control array work the way I think it should fails.

2. I get a type mismatch on char 2 which makes no sense to me. Here is the specific code:

for i = 0 to ubound( EditStatistics )
EditStatistics(i) = g_Statistics(i)
next

3. The array I want would be based on 2 of these objects exactly like this:

<OBJECT id=EditStatistics style="LEFT: 0px; COLOR: rgb(255,255,255); TOP: 0px; BACKGROUND-COLOR: rgb(0,0,128)" height=20 hspace=2 width=30 align=center vspace=2 classid="clsid:978C9E23-D4B0-11CE-BF2D-00AA003F40D0">

<PARAM NAME="ForeColor" VALUE="16777215">
<PARAM NAME="BackColor" VALUE="0">
<PARAM NAME="VariousPropertyBits" VALUE="8388635">
<PARAM NAME="Caption" VALUE="">
<PARAM NAME="PicturePosition" VALUE="458753">
<PARAM NAME="Size" VALUE="794;529">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="BorderColor" VALUE="2147483654">
<PARAM NAME="BorderStyle" VALUE="0">
<PARAM NAME="SpecialEffect" VALUE="0">
<PARAM NAME="Accelerator" VALUE="0">
<PARAM NAME="FontName" VALUE="MS Sans Serif">
<PARAM NAME="FontEffects" VALUE="1073741825">
<PARAM NAME="FontHeight" VALUE="160">
<PARAM NAME="FontOffset" VALUE="0">
<PARAM NAME="FontCharSet" VALUE="1">
<PARAM NAME="FontPitchAndFamily" VALUE="0">
<PARAM NAME="ParagraphAlign" VALUE="1">
<PARAM NAME="FontWeight" VALUE="400">
</OBJECT>

4. I want to be able to use for/next loops instead of naming and referring to each control specifically every time I iterate through them. Big ole pain.

BTW - I tried to Dim i but that didnt do anything.

series0
August 22nd, 2002, 02:38 PM
Bump ?!?