VB利用api删除元素

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Dim Test%()

Private Sub Command1_Click()
Dim i%
For i = 0 To UBound(Test)
If i = 10 Then
CopyMemory Test(10), Test(11), 178
ReDim Preserve Test(UBound(Test) - 1)
End If
Next
MsgBox UBound(Test)
MsgBox Test(98)
End Sub

Private Sub Form_Load()
Dim i%
For i = 0 To 99
ReDim Preserve Test(i)
Test(i) = i
Next
End Sub

 

posted on 2016-07-13 10:39  xbj_hyml  阅读(359)  评论(0编辑  收藏  举报

导航