Dim num As Integer Private Sub Command1_Click() Call createList End Sub Private Sub createList() For i = 0 To num - 1 Set List = Controls.Add("VB.ListBox","List" & i) List.Top = 10 List.Width = 300 List.Height = 300 List.Left = i * 400 + 300 List.Visible = True Next
Controls.Item(1).Top = 500 '改变form窗体中第二个加进来的组件
End Sub
Private Sub Form_Load()
num = 9
End Sub