How about the deletion function.i just modify the insert function to delete function.is it correct.actualy i would like to delete if 04 FF 04 FF (got repeating value) i would like to delete one of the 04 FF.So can i use the function that i modify .The same thing i wana do as insert function but i wana delete this time the condition is if there is repeating value as i mentioned just now.
[CODE=vb]Public Function DeleteByte(pmAr ray() As Byte, pmPosition As Long, ByVal pmNewValue As Byte)
' Function to delete a new byte value into a byte array.
Dim ArrayStart As Long, ArrayEnd As Long
Dim I As Long
ArrayStart = LBound(pmArray)
ArrayEnd = UBound(pmArray) -1
' Expand array to make room for the new value.
ReDim Preserve pmArray(ArraySt art To ArrayEnd)
' If requested position is outside the array, just stick it
' at the start or end as appropriate.
If pmPosition < ArrayStart Then
pmPosition = ArrayStart
End If
If pmPosition > ArrayEnd Then
pmPosition = ArrayEnd
End If
' Unless adding to the end of the array,
' push everything across to make room.
If pmPosition < ArrayEnd Then
For I = ArrayEnd To pmPosition -1 Step -1
pmArray(I) = pmArray(I - 1)
Next
End If
pmArray(pmPosit ion) = pmNewValue
End Function[/CODE]
[CODE=vb]Public Function DeleteByte(pmAr ray() As Byte, pmPosition As Long, ByVal pmNewValue As Byte)
' Function to delete a new byte value into a byte array.
Dim ArrayStart As Long, ArrayEnd As Long
Dim I As Long
ArrayStart = LBound(pmArray)
ArrayEnd = UBound(pmArray) -1
' Expand array to make room for the new value.
ReDim Preserve pmArray(ArraySt art To ArrayEnd)
' If requested position is outside the array, just stick it
' at the start or end as appropriate.
If pmPosition < ArrayStart Then
pmPosition = ArrayStart
End If
If pmPosition > ArrayEnd Then
pmPosition = ArrayEnd
End If
' Unless adding to the end of the array,
' push everything across to make room.
If pmPosition < ArrayEnd Then
For I = ArrayEnd To pmPosition -1 Step -1
pmArray(I) = pmArray(I - 1)
Next
End If
pmArray(pmPosit ion) = pmNewValue
End Function[/CODE]
Comment