Results 1 to 19 of 19

Thread: [RESOLVED] ComboBox, DataSource, and AutoComplete

  1. #1

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Resolved [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?

  2. #2
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: ComboBox, DataSource, and AutoComplete

    Quote Originally Posted by formlesstree4 View Post
    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 ??

  3. #3

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: ComboBox, DataSource, and AutoComplete

    Did you not read the post? I did set the properties, unless I missed one somewhere.

  4. #4
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: ComboBox, DataSource, and AutoComplete

    Quote Originally Posted by formlesstree4 View Post
    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

  5. #5

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: ComboBox, DataSource, and AutoComplete

    Quote Originally Posted by billboy View Post
    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.

  6. #6
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    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

  7. #7

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: ComboBox, DataSource, and AutoComplete

    It does not work, I have tired that both in the editor and in the code.

  8. #8
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    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

  9. #9
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    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
    Attached Files Attached Files

  10. #10

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: ComboBox, DataSource, and AutoComplete

    Quote Originally Posted by kevininstructor View Post
    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.
    Attached Files Attached Files

  11. #11
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: ComboBox, DataSource, and AutoComplete

    Quote Originally Posted by formlesstree4 View Post
    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.

  12. #12
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,517

    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

  13. #13

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    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.

  14. #14
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,517

    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.

  15. #15

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: ComboBox, DataSource, and AutoComplete

    So it's doing the AutoComplete for you? It's still not working for me..

  16. #16
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,517

    Re: ComboBox, DataSource, and AutoComplete

    Sorry didn't test the autocomplete. Get back to you

  17. #17
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,517

    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

  18. #18

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: ComboBox, DataSource, and AutoComplete

    Wow...thanks a bunch wes. I'll give that a shot!

  19. #19

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: ComboBox, DataSource, and AutoComplete

    Worked perfectly, now the AutoComplete is good!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width