Case in-sensitive dictionary

后端 未结 2 1993
旧时难觅i
旧时难觅i 2020-12-21 00:16

I have set Dictionary as an object an added several items to that dictionary, however it seems to be case-sensitive. Is there anyway I can set the dictionary to recognize di

相关标签:
2条回答
  • 2020-12-21 00:58

    I always like to set things straight for all of my coding. So, all modules and code lying on my sheets or in forms start with the following three lines before writing any additional code.

    Option Base 0
    Option Explicit
    Option Compare Text
    

    If I want to have something handled differently in a particular Sub for some reason, then I do so in this particular sub only and do as proposed in the comment above (example):

    dict.CompareMode = BinaryCompare 'if I need a case-sensitive compare in this sub
    

    Since VBE knows that dict is a Dictionary it can provide propositions for auto-complete. This is only possible with early-binding. With late binding VBE will not provide any auto-complete propositions.

    0 讨论(0)
  • 2020-12-21 01:12

    Adding onto @Ralph

    dict.CompareMode = TextCompare
    

    is what I changed the file to.

    0 讨论(0)
提交回复
热议问题