Results 1 to 6 of 6

Thread: Dropdown Combobox Predictive Text

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    321

    Dropdown Combobox Predictive Text

    Hi All

    I have 2 questions.

    Question 1:

    I have a combobox and have 10 items in it (Name of countries).

    I want to make the users life easy so that when they click inside the combobox and start writing then the text box will start predicting the rest of the text in the combo box. i.e. if i start writing "U" then the textbox will start predicting "UK" as "UK" is already a pre-populated item in the combobox.

    Question 2:

    How can i restrict the user from selecting only values within the pre-populated items of the combobox. Bearing in mind the combobox allows the user to write inside it (for the benefit of predictive text). But lets say there are values of UK, USA then I dont want the combobox to accept the value of "Ukraine" when the user clicks away from the combobox.

    Any ideas?

    Thanks

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Dropdown Combobox Predictive Text

    Set the ComboBox.DropDownStyle=DropDownList.

    This will force the user to select only item from list.
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    321

    Re: Dropdown Combobox Predictive Text

    Quote Originally Posted by danasegarane View Post
    Set the ComboBox.DropDownStyle=DropDownList.

    This will force the user to select only item from list.
    But this will stop the predictive text as i explained in Question 1

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Dropdown Combobox Predictive Text

    Then Populate the values of the items in combo box . And use this collection to create the

    AutoCompleteSource Property to Custom

    Then set the AutoCompleteMode Property to Suggest , and set the AutoCompleteCustomSource as your collections.

    For checking the items it currently checked, check the selected index property of the combox. If any thing is selected from items in the Combox, then it will be > -1 , where 0 is the first item.

    MSDN Example for Auto Suggest
    Please mark you thread resolved using the Thread Tools as shown

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    321

    Re: Dropdown Combobox Predictive Text

    Quote Originally Posted by danasegarane View Post
    Then Populate the values of the items in combo box . And use this collection to create the

    AutoCompleteSource Property to Custom

    Then set the AutoCompleteMode Property to Suggest , and set the AutoCompleteCustomSource as your collections.

    For checking the items it currently checked, check the selected index property of the combox. If any thing is selected from items in the Combox, then it will be > -1 , where 0 is the first item.

    MSDN Example for Auto Suggest
    Many thanks

  6. #6
    Addicted Member
    Join Date
    Jun 2009
    Location
    Townsville, Qld, Australia
    Posts
    135

    Re: Dropdown Combobox Predictive Text

    Another alternative you might want to consider would be a list box, rather than a combo box.

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