Combobox Autocomplete

FahvRay

Member
Joined
Aug 2, 2007
Messages
6
Programming Experience
1-3
I have a bound combobox that I would like to have these settings
AutoCompleteMode = Append
AutoCompleteSource = ListItems
DropDownStyle = Dropdown

When I do this, I get this error on the Me.Close() of the Form

"Cannot bind to the property or column (Valuemember) on the DataSource."
Parameter name: dataMember

The combobox works with these settings just fine. It just creates this error!
 
OK, as a test, what happens if you don't set the 2 AutoComplete lines.

I.E. if you just set up a normal combobox without the autocomplete, do you still get the error when you close the form? (this will then see whether it's an error with your databindings or an error with the autoComplete settings)
 
I did, of course, check various settings of the Autocomplete lines. The problem does not appear with any other settings.

With these settings, the user is able to type letters into the box and the names are filled in matching the listitems. There are other options that only recognize the first letter. If you type "B" if goes to the items starting with B's, then if you type "e" it goes to items starting with the e's. But, I want it to go to the Be's, which is why I need these settings.

What this should have to do with binding on the form close, I have no idea!
 
This apparently has to do with the DropDownStyle property.

"DropDown" makes the combobox editable. It then errors on a databinding that occurs when closing the form, even if nothing is edited.

"DropDownList" is not editable, and does not error.

As a workaround, I changed the DropDownStyle property to DropDownList on the form closing event, and it seems to be ok.

Treating the symptom, not the disease.
 
Back
Top