Set a value with SelectedItem

Mar 18, 2015 at 3:28 PM
Hi,

here again, very satisfied about your wonderful control works.

Besides using it for display options and let user select from, I also need to set the selected item property while loading already available data in order to display them.

I'm trying to do this assigning a value to SelectedItem and it seems to work but when the GUI appears the items list opens in every AutoCompleteTextBox I have in the panel, showing the options matching with the text inside and the correct option actually selected.
Anyway, I would prefer that only the text on the control appears when loading a value directly, with no need to let the user select from many option.

I don't know if I was able to explain it clearly, let me know if you need some more information

Cheers
Giacomo
Coordinator
Mar 19, 2015 at 4:09 AM
Hi Giacomo,

Could you please check and confirm that you are not assigning a value to Text property of AutoCompleteTextBox.

In AutoCompleteTextBox.cs in OnEditorTextChanged method try replacing
if (Editor.Text.Length)
with
if (Editor.Text.Length > 0 && IsKeyboardFocusWithin)
Hope this helps :)

Cheers!
Deepak
Marked as answer by deepdotnet on 3/19/2015 at 12:17 AM
Mar 19, 2015 at 8:11 AM
Hi Deepak,

at first I was actually assigning a value both to SelectedItem and Text properties of AutoCompleteTextBox and I then guessed that the problem was in assigning the Text property so I avoided to do that but the issue was still there.

Changing the code in OnEditorTextChanged as you suggested solved the issue and now it seem to work greatly.

Thank you once again, you're doing an amazing job!

Cheers
Giacomo