Hello,
Lookup doesn't return a boolean. If the key exists, it return the
value associated with the key, otherwise it return the passed value.
Thanks,
Navdeep Bains
Bains Software
On Apr 29, 2008, at 8:56 PM, Gerard Hammond wrote:
> Hi All,
>
> I need to look into a dictionary just to see if a key exists.
>
> But the key seems to only exist if the value is an integer. 0 and
> doubles for the value cause the key to not be found by .lookup
>
> This sounds like a bug to me.
> What am I doing wrong?
>
>
> dim n as new Dictionary
> n.Value("thiskey") = 1 ' changing this to 0 leads to Nope, setting
> this to 1 leads to Yep, setting this to 1.2 leads to Nope - That is
> just weird...
>
> if n.Lookup("thiskey", -1) Then
> MsgBox "yep this key exists"
> else
> MsgBox "nope this key does not exists"
> end if
>
>
> Cheers.
>
> --
>
> Dr Gerard Hammond
> Garvan Institute of Medical Research
>
>
>
> Cheers.
>
> --
>
> Dr Gerard Hammond
> http://www.macsos.com.au
>
> The Macintosh may only have 10% of the market, but it is clearly the
> top 10%.
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|