本帖最后由 yeosn 于 2010-10-26 11:10:39 编辑

解决方案 »

  1.   

    我用了如下语句还是不行
    Dim b As Object
    Set b = CreateObject("project2.Usercontrol1")
    Dim a As UserControl1
    Set a = Controls.Add("project2.Usercontrol1", "aaa")
    a.Top = 0
    a.Left = 0
    a.Visible = True
    在运行时会提示usercontrol1这个数据类型没有定义
      

  2.   

    好了,找到方法了,用下面的代码就可以了
    Dim b As Object
    Set b = CreateObject("project2.Usercontrol1")Dim a As Control
    Dim a As Control
    Set a = Controls.Add("project2.Usercontrol1", "aaa")
    a.Top = 0
    a.Left = 0
    a.Visible = True