'(摘自MSDN)
'Add 方法语法有这些部分:
'object.Add (ProgID, name, container)
'
'Object 必需的。一个对象表达式,其值是“应用于”列表中的一个对象。
'ProgID 必需的。一个标识控件的字符串。
'name 必要的。一个字符串,用来标识集合的成员。
'container 可选的。一个对象引用,它指定控件的容器。如果没有指定或为 NULL,缺省值为 Controls 集合所属的容器。通过指定该参数,可以把一个控件放置在任何现存的容器控件(如 Frame 控件)中。用户控件或 ActiveX 文档也可以作为一个容器。指定container 就行了.

解决方案 »

  1.   

    Load Frame1(1)
    Frame1(1).Left = Left
    Frame1(1).Top = top
    Frame1(1).Visible = True
    Load Option1(1)
    Set Option1(1).Container = Frame1(1)
    Option1(1).Left = left
    Option1(1).Top = top
    Option1(1).Visible = True
      

  2.   

    baoxiang(包香),可是我怎么都无法看到option1(i)出现在frame1(i)的里面,是不是left和top设置的问题。你能不能试试看。
      

  3.   

    应该是left和top没有设置对。
    如果不设,Option1(i)的确不会显示。
      

  4.   

    可是我已经试过多种left和top设置,但就是出不来,ft。
      

  5.   

    Dim opt(1) As VB.OptionButton
    Set opt(1) = Controls.Add("VB.OptionButton", "opt1", frame1(0))
    with opt(1)
        .Left=100
        .Right=100
        .Visable=true
    end with
      

  6.   

    你用
    Option1(1).left=0
    Option1(1).top=0
    试试,Option的left和top应该以Frame的左上角为(0,0)。
    是不是你的top值不对了?
    我的情况如下:
    Frame1(0).top=360
    Frame1(0).left=240
    Option1(0).top=480
    Option1(0).left=480
    这时,程序如下:
    Load Frame1(1)
    Frame1(1).Left = 240
    Frame1(1).Top = 3000
    Frame1(1).Visible = True
    Load Option1(1)
    Set Option1(1).Container = Frame1(1)
    Option1(1).Left = 480
    Option1(1).Top = 480
    Option1(1).Visible = True
      

  7.   

    记得前两天我也碰到过这个问题并且做答了。
    主要是设置控件的Container属性就行了!