查看完整版本: 求教

wdp221651 2006-8-18 18:31

求教

各位仁兄:
   我想实现每点击一次增加一个控件,但代码好象有一点小问题.只能执行一次.而且重新按时没有出错
   Private Sub Command2_Click()
If AorNot Then
  Load a(a.UBound + 1)
   a(a.UBound).Visible = True
   a(a.LBound).Top = 120
    a(a.UBound).Top = a(a.UBound) + 495
    a(a.UBound).Caption = Text1.Text
   Else
   Load b(b.UBound + 1)
    b(b.UBound).Visible = True
   b(b.LBound).Top = 120
    b(b.UBound).Top = b(b.UBound) + 495
   b(b.UBound).Caption = "CC"
End If
End Sub

Nothing 2006-8-18 20:59

[code]
       i = b.UBound + 1
        Load b(i)
        b(i).Visible = True
        b(i).Top = 120
        b(i).Top = b(i - 1).Top + 495
        b(b.UBound).Caption = "CC"
[/code]
因为你增加了控件之后,UBound已经变了
页: [1]
查看完整版本: 求教