Results 1 to 5 of 5

Thread: Can I create a control array of this?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Carolina, Puerto Rico, USA
    Posts
    227

    Talking

    Im using this to create buttons at run time, draggin them from another form

    Code:
    Set Boton = frmDropWindow.Controls.Add("VB.CommandButton", ControlName)
    Is there a way to make a control array of them?, because when one is created, the older one stops working, so they are pretty much useless.

    Thanks :0
    NievesJ

  2. #2
    Guest
    Once you create the 1st control, set the Index to 0 then create the same control again (with the same name) and it'll automatically go to 1, 2, 3 etc.

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I didn't think you could set the index at run time.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Carolina, Puerto Rico, USA
    Posts
    227
    Nope, the index cant be changed during run time

    im toying now with object.ContainedControls

    im still looking for info on it, there seems to be a way with that, havent found an example yet .

    Thanks for the time
    NievesJ

  5. #5
    New Member
    Join Date
    Nov 2000
    Posts
    14

    naming the buttons

    got this code from kedaman the other time,

    Set Boton = frmDropWindow.Controls.Add("VB.CommandButton", "ControlName" & arrayNumber)


    Just add the array number to the controlname, producing a ControlName1, ControlName2, etc..keeps the names unique
    Works great!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width