|
Author |
Message |
Bob Brow #1 / 6
|
 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 |
|
 |
Clytemnestr #2 / 6
|
 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 |
|
 |
D.. #3 / 6
|
 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 |
|
 |
D.. #4 / 6
|
 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 |
|
 |
Bob Brow #5 / 6
|
 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 |
|
 |
Clytemnestr #6 / 6
|
 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 |
|
|
|