dim a(30) for i=1 to 30 a(i)=i next i private sub command1_click() static count as integer if count <=30 then count=1 text1.text=a(count) a(count)=0 count=count+1 else msgbox"数组的数已经清空" end sub
第2个回答 2009-06-15
Option Base 1 Dim n As Integer Dim a() Private Sub form_load() n = 30 End Sub Private Sub cmd1_click() ReDim a(n) For i = 1 To n a(i) = i Next i MsgBox Str(a(n)) & "已删除" n = n - 1 If n = 0 Then MsgBox "数据已全部删除“" End Sub
第3个回答 2009-06-16
Dim a() As Variant
Private Sub Command1_Click() Randomize Dim x As Integer If UBound(a) = 0 Then Exit Sub x = Int(Rnd * UBound(a) + 1) MsgBox a(x) a(x) = "" For i = x To UBound(a) - 1 a(i) = a(i + 1) Next ReDim Preserve a(i - 1) Print For i = 1 To UBound(a) Print a(i); Next End Sub
Private Sub Form_Load() Me.Show For i = 1 To 30 ReDim Preserve a(i) a(i) = i Print a(i); If i Mod 10 = 0 Then Print Next End Sub本回答被提问者采纳