Dynamic control creation 
Author Message
 Dynamic control creation

Dynamic control creation....

I understand that, from reading in a newsgroup post,  one can load
additional controls into an array of
controls of the same type if you have at least one member defined with an
index in the IDE.

How does one do this? Are there any examples or resources anywhere where
this is shown as an example?

Thanks!

BB



Wed, 13 Jul 2005 09:45:38 GMT  
 Dynamic control creation
At design time, create a control with an index value (eg MyTextBox(0) --
doesn't have to be zero, that's just the default). You can create more than
one member of the collection at design time.

Run time:

Load MyTextBox(1)   --- doesn't have to be 1, nor do you have to use the
indexes in order. Just any index that isn't yet used.

and

Unload MyTextBox(1)    ... You can't unload the design-time members.

You can iterate your collection using:

Dim pTextBox as TextBox
For each pTextBox in MyTextBox
    ....
Next


Quote:
> Dynamic control creation....

> I understand that, from reading in a newsgroup post,  one can load
> additional controls into an array of
> controls of the same type if you have at least one member defined with an
> index in the IDE.

> How does one do this? Are there any examples or resources anywhere where
> this is shown as an example?

> Thanks!

> BB



Wed, 13 Jul 2005 09:52:54 GMT  
 Dynamic control creation
Look up Load....
Example:

mycontrol is set with an index of zero

to create, ie: load, another one do the following
lButton=UBound(mycontrol) + 1 'lButton can be used for keeping count of your controls if needed...
Load mycontrol(lButton)
With mycontrol(lButton)
        .Caption = "what ever you want here"
        .Height = some size if needed
             .Width = some size if needed
        .Left = some position to move it somewhere else
        .Top = same as with Left
        .Visible = True ' this is needed because you can't see it.. kind of like Load Form and Show Form
        .what ever else needs to be set
End With

HTH

Quote:

>Dynamic control creation....

>I understand that, from reading in a newsgroup post,  one can load
>additional controls into an array of
>controls of the same type if you have at least one member defined with an
>index in the IDE.

>How does one do this? Are there any examples or resources anywhere where
>this is shown as an example?

>Thanks!

>BB

Have a good day...

Don



Wed, 13 Jul 2005 09:59:08 GMT  
 Dynamic control creation
Simple Remark to using helter-skelter indexes...
Makes coding in the events for the control kind of helter-skelter also...

Quote:

>At design time, create a control with an index value (eg MyTextBox(0) --
>doesn't have to be zero, that's just the default). You can create more than
>one member of the collection at design time.

>Run time:

>Load MyTextBox(1)   --- doesn't have to be 1, nor do you have to use the
>indexes in order. Just any index that isn't yet used.

>and

>Unload MyTextBox(1)    ... You can't unload the design-time members.

>You can iterate your collection using:

>Dim pTextBox as TextBox
>For each pTextBox in MyTextBox
>    ....
>Next



>> Dynamic control creation....

>> I understand that, from reading in a newsgroup post,  one can load
>> additional controls into an array of
>> controls of the same type if you have at least one member defined with an
>> index in the IDE.

>> How does one do this? Are there any examples or resources anywhere where
>> this is shown as an example?

>> Thanks!

>> BB

Have a good day...

Don



Wed, 13 Jul 2005 10:02:43 GMT  
 Dynamic control creation
Many thanks to you and Don ---that was exactly what I was looking for.

BB


Quote:
> At design time, create a control with an index value (eg MyTextBox(0) --
> doesn't have to be zero, that's just the default). You can create more
than
> one member of the collection at design time.

> Run time:

> Load MyTextBox(1)   --- doesn't have to be 1, nor do you have to use the
> indexes in order. Just any index that isn't yet used.

> and

> Unload MyTextBox(1)    ... You can't unload the design-time members.

> You can iterate your collection using:

> Dim pTextBox as TextBox
> For each pTextBox in MyTextBox
>     ....
> Next



> > Dynamic control creation....

> > I understand that, from reading in a newsgroup post,  one can load
> > additional controls into an array of
> > controls of the same type if you have at least one member defined with
an
> > index in the IDE.

> > How does one do this? Are there any examples or resources anywhere where
> > this is shown as an example?

> > Thanks!

> > BB



Wed, 13 Jul 2005 10:49:49 GMT  
 Dynamic control creation

Quote:
> Simple Remark to using helter-skelter indexes...
> Makes coding in the events for the control kind of helter-skelter also...

Indeed. Wasn't recommending the practice, just saying it's possible. And it
can be appropriate in some cases, eg where the index relates to something
else in the app.


Wed, 13 Jul 2005 12:38:16 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Dynamic Controls Creation and Referencing the new Control.

2. Dynamic Control Creation, Controls object has no .Add ???

3. Dynamic Control Creation - Expand Form?

4. Dynamic control creation and calling DOS programs from VB.

5. VB6-Dynamic Control Creation

6. Dynamic control creation-HOW???

7. Dynamic control creation?

8. Dynamic control creation

9. dynamic control creation

10. Dynamic Control creation in eVB

11. Dynamic Controls Creation

12. Dynamic control creation

 

 
Powered by phpBB® Forum Software