Olaf:
Can u help make KeyByIndex property to be editable?

I have and these codes to cHashD, but can not make it.



Code:
Private Declare Function VariantCopyLng Lib "oleaut32" Alias "VariantCopy" (Dst As Long, Src As Long) As Long

Public Property Let KeyByIndex(ByVal IndexZeroBased As Long, RHS)
    If IndexZeroBased < 0 Or IndexZeroBased >= mCount Then Err.Raise 9
    Select Case mKeyMode
        Case eUseStrings:
            RHS = CStr(RHS)
            VariantCopyLng ByVal VarPtr(mKeys(IndexZeroBased)), ByVal VarPtr(RHS)
        Case eUseIntegers:
            VariantCopyLng ByVal VarPtr(mCurs(IndexZeroBased)), ByVal VarPtr(RHS)
        Case eUseDoubles:
            VariantCopyLng ByVal VarPtr(mDbls(IndexZeroBased)), ByVal VarPtr(RHS)
    End Select
End Property

Public Property Set KeyByIndex(ByVal IndexZeroBased As Long, RHS)
    If IndexZeroBased < 0 Or IndexZeroBased >= mCount Then Err.Raise 9
    KeyByIndex(IndexZeroBased) = RHS
End Property

Code:
Sub testll()
Dim c As New cHashD
c.Add 1, 11
c.KeyByIndex(0) = "2"
Debug.Print c.KeyByIndex(0)   'the key is still "1"
End Sub