Private Sub Command1_Click()
Dim xxx As TextBox
Set xxx = Form2.Controls.Add("VB.textbox", "mytext1")
xxx.Left = 200
xxx.Top = 100
xxx.Visible = True
Form2.Show
End Sub
可以,以下代码调试通过
Private Sub Command1_Click()
Dim cmbDropList As ComboBox
Set cmbDropList = Form2.Controls.Add("VB.ComboBox", "cmbDropList")
cmbDropList.Visible = True
Form2.Show
End Sub
注意在工程中加载两个窗体