动态创建vb组件

前端之家收集整理的这篇文章主要介绍了动态创建vb组件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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
原文链接:https://www.f2er.com/vb/259294.html

猜你在找的VB相关文章