# Autocomplete (ComboBox) case sensitivity

**URL:** <https://forum.xojo.com/t/autocomplete-combobox-case-sensitivity/77358>\
**Category:** General\
**Created:** [September 22, 2023, 4:52pm UTC](https://forum.xojo.com/t/autocomplete-combobox-case-sensitivity/77358 "2023-09-22T16:52:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Eidsvoog](https://forum.xojo.com/user_avatar/forum.xojo.com/john_eidsvoog/32/1798_2.png) [@John\_Eidsvoog](https://forum.xojo.com/u/John_Eidsvoog)\
**Post date:** [September 22, 2023, 4:52pm UTC](https://forum.xojo.com/t/autocomplete-combobox-case-sensitivity/77358/1 "2023-09-22T16:52:15Z")

</div>

Is there a way to make Autocomplete update the case of the entered text?

Let’s say I’m typing “blu” and “blue Moon” pops in as the autocomplete result. “Blue Moon” is the source of the Autocomplete. If I just accept the text, I don’t get the capitalized “Blue”.

Do I have to search through my source array to find the correct result or is there a parameter I’m missing?

I’m sorry if this is too silly/trivial to bring up as a topic.

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [September 22, 2023, 4:56pm UTC](https://forum.xojo.com/t/autocomplete-combobox-case-sensitivity/77358/2 "2023-09-22T16:56:30Z")

</div>

You could probably use the case insensitivity of a Xojo string comparison to your advantage.

In all of the locations a change event is implemented (for ComboBox it varies between Mac and Windows)

```auto
var iTargetIndex as Integer = arsMyValues.IndexOf(me.Text)
if iTargetIndex > -1 then
  // Set the exact value that's in the array so that the desired casing is applied
  me.Text = arsMyValues(iTargetIndex)

end

```

The framework is usually pretty good at preventing infinite loops caused by events like this, but you may wish to add your own protection against that.

---

<div class="post-metadata">

**Author:** ![John\_Eidsvoog](https://forum.xojo.com/user_avatar/forum.xojo.com/john_eidsvoog/32/1798_2.png) [@John\_Eidsvoog](https://forum.xojo.com/u/John_Eidsvoog)\
**Post date:** [September 22, 2023, 6:10pm UTC](https://forum.xojo.com/t/autocomplete-combobox-case-sensitivity/77358/3 "2023-09-22T18:10:28Z")

</div>

Thanks, Tim. Is this some kind of magic? Does IndexOf search the entire array? I still have to loop through my array, right?

---

<div class="post-metadata">

**Author:** ![John\_Eidsvoog](https://forum.xojo.com/user_avatar/forum.xojo.com/john_eidsvoog/32/1798_2.png) [@John\_Eidsvoog](https://forum.xojo.com/u/John_Eidsvoog)\
**Post date:** [September 22, 2023, 10:21pm UTC](https://forum.xojo.com/t/autocomplete-combobox-case-sensitivity/77358/4 "2023-09-22T22:21:55Z")

</div>

OK, I found it (IndexOf) as an array method. I don’t know how I missed that, or maybe it was recently added? Anyway, this makes it easy. Thanks for the solution.
