Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7849447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:31:19+00:00 2026-06-02T18:31:19+00:00

Possible Duplicate: C# AutoComplete I’ve a standard winform combobox. I’ve set its AutoComplete property

  • 0

Possible Duplicate:
C# AutoComplete

I’ve a standard winform combobox. I’ve set its AutoComplete property to true. I want to change the comparison between typed text and items text which is done automatically by the UI.

Something like:

autoCompleteCombo.XXXX = new Func<string, string, bool> { (search, item) => item.Contains(search) };

Note: the function wrote is just an example. What I really want a little more complex.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:31:23+00:00Added an answer on June 2, 2026 at 6:31 pm

    Since you’ve updated your question, I understand your question better. You’ve also said the underlying data and function aren’t pertinent, which makes it difficult to understand exactly what you’re trying to achieve, so my recommendation would be to create a custom ComboBox and see if you can handle the matching on your own.


    I think the most elegant way to write a function to test whether the typed text is an item in a ComboBox would be to use an extension method. Your calls would look like this:

    // see if the Text typed in the combobox is in the autocomplete list
    bool bFoundAuto = autoCompleteCombo.TextIsAutocompleteItem();
    
    // see if the Text type in the combobox is an item in the items list
    bool bFoundItem = autoCompleteCombo.TextIsItem();
    

    The extension methods could be created as follows where you can customize exactly how your search logic is to work. In the two extension methods I wrote below, they simply check to see if the text typed into the ComboBox is found in the AutoCompleteCustomSource collection, or, in the second function, if the text is found in the Items collection.

    public static class MyExtensions
    {
        // returns true if the Text property value is found in the 
        // AutoCompleteCustomSource collection
        public static bool TextIsAutocompleteItem(this ComboBox cb)
        {
            return cb.AutoCompleteCustomSource.OfType<string>()
                .Where(a => a.ToLower() == cb.Text.ToLower()).Any();
        }
    
        // returns true of the Text property value is found in the Items col
        public static bool TextIsItem(this ComboBox cb)
        {
            return cb.Items.OfType<string>()
                .Where(a => a.ToLower() == cb.Text.ToLower()).Any();
        }
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: C++ templates that accept only certain types For example, if we want
Possible Duplicate: What is the difference between a function expression vs declaration in JavaScript?
Possible Duplicate: Is there a W3C valid way to disable autocomplete in a HTML
Possible Duplicate: Can Google Maps/Places 'autocomplete' API be used via AJAX? There seems to
Possible Duplicate: std::string and its automatic memory resizing I am just curious, how are
Possible Duplicate: Getting jQueryUi Autocomplete to work with jQueryMobile Is there a out of
Possible Duplicate: C - Difference between char var[] and char *var? I have written
Possible Duplicate: What is the difference between #include <filename> and #include “filename”? I just
Possible Duplicate: jQuery autocomplete UI- I'd like it to start the search onfocus without
Possible Duplicate: Unload a module in Python After importing Numpy, lets say I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.