-
[RESOLVED] ComboBox, DataSource, and AutoComplete
I have a ComboBox which is bound with a DataSource from (obviously) a Database. However, there are 659 different entries inside this Database and I was hoping to tack on AutoComplete.
I tried setting the Source to the ListItems since, after initialization and the data is bound, all the items necessary are in fact inside the ComboBox so I had assumed that it would pick that up. I was wrong. I tried using a Custom source but VS errored out saying that I couldn't do that since the ComboBox was bound.
My question is, how can I utilize AutoComplete's "Suggest" mode with a bound ComboBox?
-
Re: ComboBox, DataSource, and AutoComplete
Quote:
Originally Posted by
formlesstree4
I have a ComboBox which is bound with a DataSource from (obviously) a Database. However, there are 659 different entries inside this Database and I was hoping to tack on AutoComplete.
I tried setting the Source to the ListItems since, after initialization and the data is bound, all the items necessary are in fact inside the ComboBox so I had assumed that it would pick that up. I was wrong. I tried using a Custom source but VS errored out saying that I couldn't do that since the ComboBox was bound.
My question is, how can I utilize AutoComplete's "Suggest" mode with a bound ComboBox?
Isn't there a property setting for the combobox ??
-
Re: ComboBox, DataSource, and AutoComplete
Did you not read the post? I did set the properties, unless I missed one somewhere.
-
Re: ComboBox, DataSource, and AutoComplete
Quote:
Originally Posted by
formlesstree4
Did you not read the post? I did set the properties, unless I missed one somewhere.
Sorry was coming back to say i "mis read your post" my apologies
-
Re: ComboBox, DataSource, and AutoComplete
Quote:
Originally Posted by
billboy
Sorry was coming back to say i "mis read your post" my apologies
It's fine, just curious if there's a property I overlooked somewhere.
-
Re: ComboBox, DataSource, and AutoComplete
did you set the mode? I dont beleive it will do anything if you dont have the mode set to something
I set AutoCompleteMode to SuggestAppend
AutoComplete Source to ListItems
-
Re: ComboBox, DataSource, and AutoComplete
It does not work, I have tired that both in the editor and in the code.
-
Re: ComboBox, DataSource, and AutoComplete
That is strange, I have my Combobox bound to my datasource using a Bindingsource
Combobox set to AutoCompleteMode SuggestAppend and AutoCompleteSource List Items
everything else is default values of a ComboBox and it works fine both in 2005 and 2008 perhaps there is something in 2010? But from reading it doenst appear that is the case
-
1 Attachment(s)
Re: ComboBox, DataSource, and AutoComplete
The attached VS2008 reads data from XML into a DataTable (this would represent data back from your database). Sets up a ComboBox for suggest mode. When a selection is made in the ComboBox either normal or auto-complete selection the user is brought to the proper row in the underly table. Hope this helps
-
1 Attachment(s)
Re: ComboBox, DataSource, and AutoComplete
Quote:
Originally Posted by
kevininstructor
The attached VS2008 reads data from XML into a DataTable (this would represent data back from your database). Sets up a ComboBox for suggest mode. When a selection is made in the ComboBox either normal or auto-complete selection the user is brought to the proper row in the underly table. Hope this helps
Kevin,
Thanks for the example, which does work. However, I've tried moving it to my project and it still did not want to work properly. It just doesn't want to render anything at all.
I'll go ahead and attach it if anyone wants to run it, it's the frm_pokeGen that's messing up and refusing to do anything with the AutoComplete feature. I'm honestly at a loss for what to do.
-
Re: ComboBox, DataSource, and AutoComplete
Quote:
Originally Posted by
formlesstree4
Kevin,
Thanks for the example, which does work. However, I've tried moving it to my project and it still did not want to work properly. It just doesn't want to render anything at all.
I'll go ahead and attach it if anyone wants to run it, it's the frm_pokeGen that's messing up and refusing to do anything with the AutoComplete feature. I'm honestly at a loss for what to do.
I will look at it tomorrow as I only have VS2008 at home.
-
Re: ComboBox, DataSource, and AutoComplete
I did a quick test by adding this the the form load,
Code:
Debug.Print(Me.PtadbDataSet.pkm.Rows.Count)
It returned 0
at a glance it looks like there's no rows to be added to the combobox
-
Re: ComboBox, DataSource, and AutoComplete
You can generate all the rows you need by loading the Database Editor, right clicking, and hitting Generate Rows. Then that will no longer be zero.
-
Re: ComboBox, DataSource, and AutoComplete
That helps. :)
I added a combobox to the form, clicked the arrow on the top right, clicked "use databound items", selected the pkmbindingsource and selected the display memeber "name"
Ran it and it worked fine.
-
Re: ComboBox, DataSource, and AutoComplete
So it's doing the AutoComplete for you? It's still not working for me..
-
Re: ComboBox, DataSource, and AutoComplete
Sorry didn't test the autocomplete. Get back to you
-
Re: ComboBox, DataSource, and AutoComplete
No it doesn't work. but I think I found the problem. There seems to be a blank space in front of the names. I did this to the generate data,
Code:
_data(0).Substring(1)
Now the autocomplete works
Edit: it does remove the "A" on the first row, but I'm sure you can solve the problem now
-
Re: ComboBox, DataSource, and AutoComplete
Wow...thanks a bunch wes. I'll give that a shot!
-
Re: ComboBox, DataSource, and AutoComplete
Worked perfectly, now the AutoComplete is good!