On Wed, 16 May 2007 02:29:35 -0700, Doug <go**********@optusnet.com.au>
wrote:
I have a simple form, just with one combo box and an OK button - and i
have tried to use the autocomplete routine and I have enabled
autocomplete in
the combo box properties.
http://www.java2s.com/Code/CSharp/Co...teComboBox.htm
That is the link that I copied the code from - but the box doesnt
autocomplete and I dont know what i am doing wrong.
I don't really understand your question. The code you refer to in the
link has nothing to do with using the built-in auto-complete attributes of
the .NET ComboBox control.
The code you refer to in the link has a very basic auto-complete. The
AutoCompleteComboBox defined in the example only matches from things
actually in the list of the control. It should do this just fine, without
you having to set any additional properties. Just use that class if the
behavior is what you want.
On the other hand, the built-in auto-complete functionality of the .NET
ComboBox class is more powerful, and also more complicated. Note that at
a minimum, you need to set the AutoCompleteMode property to something
other than None, *and* the AutoCompleteSource to something other than
None. If you want to provide a custom list of things to match against,
you need to use the AutoCompleteCustomSource, as well as setting
AutoCompleteSource to CustomSource.
Is there another step that I am missing???
See above. My guess is that you copied the example code without
understanding what it's doing, and either haven't used the
AutoCompleteComboBox it defines, or you haven't populated the list for the
control so that it has something to match against.
But since you say you also have "enabled autocomplete in the combo box
properties", it sounds like you are *also* trying to use the built-in
functionality at the same time. I think you should probably pick one or
the other and stick with that. If you want to use the built-in
functionality, then just toss out the code example you've referred to and
make sure you've set *all* of the appropriate properties to enable the
built-in functionality to work the way you want.
Pete