dim c as object
for each c in parent.controls
debug.print c.name
next

解决方案 »

  1.   

    Un1() 的回答不错,我做了如下改动
    dim c as object
    for each c in parent.controls
        if c.Container.name=你的控件的名称 then
             debug.print c.name
        endif
    next
      

  2.   

    to hsm:
    请你看看这个例子,并发挥自己的聪明才智,将他从一个form转换到一个UserControl:
    http://www.csdn.net/dev/Visual%20Basic/source%20code/Interface/roundwin.zip
      

  3.   


    将控件放入设计床体时UserControl_Initialize()先发生,但此时并不知道容器环境。
    在其后的UserControl_InitProperties()过程中可以使用Container属性引用控件可视
    的控件容器的只读对象,遍历其中的controls,将其定义到枚举变量中。问题:在控件加入之后向窗体加入的控件将不能被自动引用。可能的折衷方法是在控件
    的resize事件中重新遍历Container中的controls。然后每加入新控件就用鼠标拖一下
    你的控件。只是想法未及实验,关注!
      

  4.   


    精灵有其他的方法么?可不可以截取控件放入窗体的消息呢?这个可的的确确是“想法”,
    因为偶根本不知道这个消息是什么,估计你需要写Add-in乐。关注 :)