Results 1 to 5 of 5

Thread: Enumeration through controls on form....Easy one!?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    norcross, ga, USA
    Posts
    82

    Question Enumeration through controls on form....Easy one!?

    I want to enumerate through all of the controls on any given form and list their names in a listbox.

    for example(obviously this doesn't work!)

    For z = 0 to me.controls.count - 1
    list1.additem me.controls(z).name
    Next z

    I am NOT talking about Control Arrays.

    Thanks in advance.

    C

  2. #2
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim ctl As Control
    3. For Each ctl In Me.Controls
    4.     list1.additem ctl.name
    5. Next
    6. End Sub

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. For Each Control In Me
    2.   List1.AddItem Control.Name
    3. Next

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    heh heh, good to see someone paying attention

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    norcross, ga, USA
    Posts
    82

    Question

    Oh well....That works great...But.....(sorry)

    I actually want to list the controls from a form on a property page in activex control that is on the form.

    Get that....?!

    C

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