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
原文地址:https://www.cnblogs.com/xbj-hyml/p/5666009.html