Hashtable does not work correct

Discussion in 'Beta Versions' started by corwin42, Apr 24, 2009.

  1. corwin42

    corwin42 Expert Licensed User

    I wanted to port a hashtable from agrahams collection library to the internal hashtable and found out that it doesn't work correct.
    I think the problem is removing an item:

    Sub App_Start
    Msgbox("Train: " & hashtable1.Item("train"))
    ' This gives an out of index error!
     'Msgbox("Train: " & hashtable1.Item("train"))
    Msgbox("Train: " & hashtable1.Item("train"))
    End Sub
    First MsgBox says "Train: black" which is correct.
    Second MsgBox gives an out of index error.
    Third MsgBox (after commenting out the second one) says "Train: yellow" which is wrong.

    BTW: If I try to use the hashtable from agrahams collection library I cannot compile because it gives an error of duplicate object "hashtable".

  2. corwin42

    corwin42 Expert Licensed User

    I don't know how the data is saved internally but would it be possible to implement an Update(key, value) method? Currently I have to do a Remove() and then Add() to update the value of a key.
  3. Erel

    Erel Administrator Staff Member Licensed User

    I like the Update idea and it will be added.
    A new release will be available tomorrow with a fix to this bug.
  4. agraham

    agraham Expert Licensed User

    Once the new release is official I will probably reissue the Collection library with the collections renamed something like HashTableEx, StackEx etc. to avoid name conflicts.
  5. agraham

    agraham Expert Licensed User

    Collections library v1.3 now posted to work with Basic4ppc v6.80.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice