none
autocomplete a combox from dataset RRS feed

  • Question

  • I have a couple of texbox and combobox controls that are bound to a dataset. I can scroll this with the a bindingnavigator. But I want to have the combobox do autocomplete from the dataset. For example, if i type a "D" in the combobox bound to the 'ClientName' column of the 'ClientInfo' table, i want the comcobox to display all (or maybe the top 20) names that start with a "D". If i then type an "E" I would like the list to show all names starting with "De" and so on.

    I have tried to bind the 'autocompletesource' of the combobox to the 'ClientName' column, but that did not appear to do anything.

    I am reasonably experienced with VB .Net, but totally new to database and data centric applications.

    By advice will be much appreciated.

    Ryn
    Ryn
    Wednesday, October 28, 2009 1:31 PM

Answers

  • Hi Frank,

    Thanks, but this did not help. I have matched all the properties settings that are visible in your screenshot with no luck.  Is it possible to send me screenshots of the other properties? 

    One stange observation is that when I click on a comboxbox that is that is binded to the dataset, the mouse becomes unresponsive.  

    One other question. Is there any code that I need to add to get the autocomplete to work (other than the code added automatically by the wizard etc)?

    Can you recommend anything worthwile to read on this subject.

    Thanks so far,
    Ryn
    Ryn

    Ryn,

    Let's see if this might help some. This isn't the only way to do it, but try this as a start and see if it clears up what's what here:

    Once you have a dataset in your project, add a combo box then click the smart tag and tick the "Use Data Bound Items":


    Next choose the data source as shown here:


    Now set all of the other parameters for displaying what you want from the dataset:



    Test it to make sure it's what you want first (before setting the autocomplete):




    Then finally, set the autocomplete like I showed earlier and try it by typing in the combo box:



    I hope this helps.

    Good luck! :)
    • Marked as answer by Ryn Wednesday, October 28, 2009 6:00 PM
    Wednesday, October 28, 2009 5:07 PM

All replies

  • Ryn,

    Be sure that you have the autocomplete source set up for "ListItems" :

    Wednesday, October 28, 2009 1:50 PM
  • Hi Frank,

    Thanks, but this did not help. I have matched all the properties settings that are visible in your screenshot with no luck.  Is it possible to send me screenshots of the other properties? 

    One stange observation is that when I click on a comboxbox that is that is binded to the dataset, the mouse becomes unresponsive.  

    One other question. Is there any code that I need to add to get the autocomplete to work (other than the code added automatically by the wizard etc)?

    Can you recommend anything worthwile to read on this subject.

    Thanks so far,
    Ryn
    Ryn
    Wednesday, October 28, 2009 4:31 PM
  • I think I may have gotten ahead of you on something.

    How did you do the binding to the combobox? That sounds like where the problem is.

    Sorry for the confusion.
    Wednesday, October 28, 2009 4:51 PM
  • Hi Frank,

    Thanks, but this did not help. I have matched all the properties settings that are visible in your screenshot with no luck.  Is it possible to send me screenshots of the other properties? 

    One stange observation is that when I click on a comboxbox that is that is binded to the dataset, the mouse becomes unresponsive.  

    One other question. Is there any code that I need to add to get the autocomplete to work (other than the code added automatically by the wizard etc)?

    Can you recommend anything worthwile to read on this subject.

    Thanks so far,
    Ryn
    Ryn

    Ryn,

    Let's see if this might help some. This isn't the only way to do it, but try this as a start and see if it clears up what's what here:

    Once you have a dataset in your project, add a combo box then click the smart tag and tick the "Use Data Bound Items":


    Next choose the data source as shown here:


    Now set all of the other parameters for displaying what you want from the dataset:



    Test it to make sure it's what you want first (before setting the autocomplete):




    Then finally, set the autocomplete like I showed earlier and try it by typing in the combo box:



    I hope this helps.

    Good luck! :)
    • Marked as answer by Ryn Wednesday, October 28, 2009 6:00 PM
    Wednesday, October 28, 2009 5:07 PM
  • Ryn,

    You can not bind a dataset to anything else then a Windowsform DataGrid (not in the toolbox from version 2.0 and later).

    You can bind datatables, those are inside datasets.

    Making a program means that you know what you do and be exact in that.


    Success
    Cor
    Wednesday, October 28, 2009 5:09 PM
  • Ryn,

    You can not bind a dataset to anything else then a Windowsform DataGrid (not in the toolbox from version 2.0 and later).

    You can bind datatables, those are inside datasets.

    Making a program means that you know what you do and be exact in that.


    Success
    Cor

    Cor,

    My apologies for getting the terms incorrect also.

    Sorry about that.
    Wednesday, October 28, 2009 5:16 PM
  • Frank,

    Thanks a lot!!!

    I made the combobox origionaly by dragging from the data sources (an of course I fiddled trying to get it right, maybe messed up something). 

    I now redefined a combobox by folowing your intructions step by step. And it worked as I wanted.

    Thanks again.

    Ryn
    Ryn
    Wednesday, October 28, 2009 6:04 PM
  • Frank,

    Thanks a lot!!!

    I made the combobox origionaly by dragging from the data sources (an of course I fiddled trying to get it right, maybe messed up something). 

    I now redefined a combobox by folowing your intructions step by step. And it worked as I wanted.

    Thanks again.

    Ryn
    Ryn

    Great!

    Dragging it in like you did originally will work - but I thought this way it would sort of show how each step does just what.

    Glad you got it working! :)
    Wednesday, October 28, 2009 6:06 PM
  • Cor,
    Exactly what does this mean?

    You can not bind a dataset to anything else then a Windowsform DataGrid (not in the toolbox from version 2.0 and later).
    
    You can bind datatables, those are inside datasets.
    
    Making a program means that you know what you do and be exact in that.
    Ryn
    Ryn
    Wednesday, October 28, 2009 6:08 PM
  • Hie, can someone help me with the code for limiting the number item SuggestAppend? I know how to use the autocomplete function, but I want to limit the the number of items suggested. For exam, when i type "Co" it would suggest up to 20 - 30 items. I just want to limit them to 5. The chosen 5 is those of the first 5 suggested.
    Sunday, October 10, 2010 7:04 AM