Controls Collection on ASP??? 
Author Message
 Controls Collection on ASP???

I'm writing an ActiveX component.  I'm trying to make the component
work in a variety of containers.  As part of its functionality, the
component needs to access all the other controls on the same form as
itself.  I do this in VB through the parent form's controls
collection.  How can I do the same thing in Visual Interdev with
ASPes?  In case it matters, it needs to access the controls collection
at design time.  I already know which events Visual Interdev fires in
an ActiveX control when the control is placed on an ASP, so that's not
a problem.  I just need to know how to access the parent's controls
collection in order to make my component work in this environment.

Any help would be greatly appreciated.


Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Fri, 31 May 2002 03:00:00 GMT  
 Controls Collection on ASP???

Dave

Im not sure why you would even want to access the Parent controls.

First Dimension a collection in the Gen Declarations  like so:

Private colControls As New Collection

Then, usually in the form load procedure, begin loading each control into this collection.
Later when you need to use the collection, for example, lets change the color of each control:

 Dim ctlControls As Control
    For Each ctlcontrol In colControls
        ctlcontrol.BackColor = vbBlue
    Next
This should be more efficient than using the parnets.

Regards
Greg

Quote:

> I'm writing an ActiveX component.  I'm trying to make the component
> work in a variety of containers.  As part of its functionality, the
> component needs to access all the other controls on the same form as
> itself.  I do this in VB through the parent form's controls
> collection.  How can I do the same thing in Visual Interdev with
> ASPes?  In case it matters, it needs to access the controls collection
> at design time.  I already know which events Visual Interdev fires in
> an ActiveX control when the control is placed on an ASP, so that's not
> a problem.  I just need to know how to access the parent's controls
> collection in order to make my component work in this environment.

> Any help would be greatly appreciated.


> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sun, 16 Jun 2002 03:00:00 GMT  
 Controls Collection on ASP???


Quote:
> This is a multi-part message in MIME format.

> ------=_NextPart_000_00B3_01BF5188.A5E65100
> Content-Type: text/plain;
>    charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

> Dave

> Im not sure why you would even want to access the Parent controls.

If you mean why am I accessing the controls collection through the
parent object, the answer is that is the only way I know to get a
reference to the controls.  If you are asking why I'm trying to access
the other controls period, that is a long story.

Quote:

> First Dimension a collection in the Gen Declarations  like so:

> Private colControls As New Collection

> Then, usually in the form load procedure, begin loading each control =
> into this collection.
> Later when you need to use the collection

You skipped the step that I really need.  How do I get a reference to
all the controls on the same form as my control?  I'd be fine with
putting them in a local collection, but I need to have a reference to
them in the first place in order to do this.

Quote:
> , for example, lets change the =
> color of each control:

>  Dim ctlControls As Control
>     For Each ctlcontrol In colControls
>         ctlcontrol.BackColor =3D vbBlue
>     Next
> This should be more efficient than using the parnets.

I agree, *if* I can get a reference to them.

Quote:

> Regards
> Greg



> > I'm writing an ActiveX component.  I'm trying to make the component
> > work in a variety of containers.  As part of its functionality, the
> > component needs to access all the other controls on the same form as
> > itself.  I do this in VB through the parent form's controls
> > collection.  How can I do the same thing in Visual Interdev with
> > ASPes?  In case it matters, it needs to access the controls
collection
> > at design time.  I already know which events Visual Interdev fires
in
> > an ActiveX control when the control is placed on an ASP, so that's
not
> > a problem.  I just need to know how to access the parent's controls
> > collection in order to make my component work in this environment.
> >=20
> > Any help would be greatly appreciated.
> >=20

> >=20
> >=20
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

> ------=_NextPart_000_00B3_01BF5188.A5E65100
> Content-Type: text/html;
>    charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content=3D"text/html; charset=3Diso-8859-1" =
> http-equiv=3DContent-Type>
> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY>
> <DIV><FONT size=3D2><BR>Dave</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT size=3D2>Im not sure why you would even want to access the
=
> Parent=20
> controls.</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT size=3D2>First Dimension a collection in the Gen
Declarations =
>  like=20
> so:</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DCourier size=3D2>Private colControls As New=20
> Collection</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT size=3D2>Then, usually in the form load procedure, begin =
> loading each=20
> control into this collection.</FONT></DIV>
> <DIV><FONT size=3D2>Later when you need to use the collection, for =
> example, lets=20
> change the color of each control:</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DCourier size=3D2>&nbsp;Dim ctlControls As=20
> Control<BR>&nbsp;&nbsp;&nbsp; For Each ctlcontrol In=20
> colControls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> ctlcontrol.BackColor =3D=20
> vbBlue</FONT></DIV>
> <DIV><FONT face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp;
Next</FONT></DIV>
> <DIV><FONT size=3D2>This should be more efficient than using the=20
> parnets.</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT size=3D2>Regards</FONT></DIV>
> <DIV><FONT size=3D2>Greg</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT size=3D2>&lt;<A=20

in =
> message <A=20


o=

- Show quoted text -

Quote:
> m</A>...</FONT></DIV><FONT=20
> size=3D2>&gt; I'm writing an ActiveX component.&nbsp; I'm trying to
make =
> the=20
> component<BR>&gt; work in a variety of containers.&nbsp; As part of
its=20
> functionality, the<BR>&gt; component needs to access all the other =
> controls on=20
> the same form as<BR>&gt; itself.&nbsp; I do this in VB through the =
> parent form's=20
> controls<BR>&gt; collection.&nbsp; How can I do the same thing in
Visual =

> Interdev with<BR>&gt; ASPes?&nbsp; In case it matters, it needs to =
> access the=20
> controls collection<BR>&gt; at design time.&nbsp; I already know
which =
> events=20
> Visual Interdev fires in<BR>&gt; an ActiveX control when the control
is =
> placed=20
> on an ASP, so that's not<BR>&gt; a problem.&nbsp; I just need to know
=
> how to=20
> access the parent's controls<BR>&gt; collection in order to make my =
> component=20
> work in this environment.<BR>&gt; <BR>&gt; Any help would be
greatly=20
> appreciated.<BR>&gt; <BR>&gt; <A=20

> <BR>&gt;=20
> <BR>&gt; Sent via Deja.com <A=20
> href=3D"http://www.deja.com/">http://www.deja.com/</A><BR>&gt; Before
=
> you=20
> buy.</FONT></BODY></HTML>

> ------=_NextPart_000_00B3_01BF5188.A5E65100--

Sent via Deja.com http://www.deja.com/
Before you buy.


Sun, 16 Jun 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Accessing control array controls using the controls collection

2. Collections, Collections and More Collections

3. using addobject with scripting control and iterating collection

4. Getting a Collection of Controls

5. Collection in ActiveX DLL (works in exe but not from ASP)

6. Using Collections in Business Objects/Transaction Server/ASP

7. ASP Collection Object - Is there one?

8. ASP, Collections, For...Each, NewEnum()

9. ActiveX dll and ASP, collections

10. Returning a collection from component to asp page

11. Returning a collection from component to asp page

12. Accessing a Collection from ASP

 

 
Powered by phpBB® Forum Software