在2000+VB6调试通过:Dim cmdbutton As CommandButtonPrivate Sub Command1_Click()
Set cmdbutton = Me.Controls.Add("VB.CommandButton", "cmdbutton")
With cmdbutton
  .Left = 100
  .Top = 100
  .Height = 500
  .Width = 1000
  .Caption = "cmd"
  .Visible = True
  .ZOrder
End With
End Sub

解决方案 »

  1.   

    生成新的TextBox:
    Dim myTextBox As TextBoxPrivate Sub Command1_Click()
    Set myTextBox = Me.Controls.Add("VB.TextBox", "txtMine")
    With myTextBox
      .Left = 100
      .Top = 100
      .Height = 500
      .Width = 1000
      .Text = "新生成"
      .Visible = True
    End With
    End Sub
      

  2.   

    Private Sub Form_Load()
       Form1.Controls.Add "VB.TextBox", "Text1", Me
       With Form1!text1
          .Visible = True
          .Width = 2000
          .Height = 1000
          .Top = 50
          .Left = 1500
          .Text = "gaoqi"
       End With
    End Sub
      

  3.   

    Dim WithEvents ttt As TextBoxSet ttt = Me.Controls.Add("VB.TextBox", "cmdOne")
    With ttt
        .Visible = True
        .Left = 10
        .Top = 10
        .Width = 1000
        .Height = 1000
    End With
      

  4.   

    Private Sub Form_Load()
       Form1.Controls.Add "VB.TextBox", "Text1", Me
       With Form1!text1
          .Visible = True
          .Width = 2000
          .Height = 1000
          .Top = 50
          .Left = 1500
          .Text = "gaoqi"
       End With
    End Sub
      

  5.   

        我也想蹭分,还有一个方法:就是用控件数组,你现在窗体上建个textbox(0)
    visible=false         在编码时用load textbox(1),load textbox(2)等加其他的控件,不过别忘了设置位置,大小和visible=true
         
        怎么样,可以给分吧,呵呵