I have a dictionary and I need to return an array of the values sorted in key order. My understanding is that the order of the keys is undefined. So I tried this:

Function GetList() As myValueObject()

Dim values() As myValueObject
Dim keys() As String

keys = myDictionary.Keys  <= Type mismatch error
values() = myDictionary.Values  <= Type mismatch error

keys.sortwith(values)

return values

End Function

Can I cast the Keys and Values to the right type? Shouldn't a Variant be assignable to anything? Or is the assumption that an array of Variants could contain different types and therefore cannot be assigned to an array of a specific type? Please tell me there is a way to do this without having to go through all the keys and/or values and assign them to the correctly declared array type.


Thanks,
Chris Griffin





_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to