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 128303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:36:51+00:00 2026-05-11T05:36:51+00:00

The desired functionality of the ‘enhanced’ combo box is a quick find method. Each

  • 0

The desired functionality of the ‘enhanced’ combo box is a quick find method. Each item in the combobox has a ToString() method, such that they can be displayed in the drop down list. On clicking an item in the drop down list, the combobox’s observers are notified of the selection.

Also, every time the typed text in the combobox changes, a list of ‘Candidates’ is generated, made of all those items in the drop down list which contain the text typed in so far. Hitting enter takes you to the first candidate in that list, repeatedly hitting enter cycles you through the list.

I’ve implemented this functionality by deriving from ComboBox – I figured this made sense as I’m still functionally left with a combobox, it just has this ‘QuickFind’ feature added. However, the logic to create the candidate list and cycle through it, whilst simple, isn’t totally trivial, and would enjoy some testing.

However, as seen here it doesn’t seem to be all that easy to test a ComboBox just by constructing it and prodding the extra routines I’ve added – it needs to exist on a form for it to behave the same way as it does in the application. This seems altogether too much effort to test a simple addition to a simple combo box!

Nothing in the code to cycle through the candidates is specific to my application however – I have created a general control that may be used in any number of contexts, the only requirement being that the objects in the combobox have a ToString() methiod, which is the same restriction placed on objects going into normal comboboxes anyway, and is guaranteed by C# .NET.

So, with testability in mind, where would you put the enhanced functionality?

  • 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. 2026-05-11T05:36:51+00:00Added an answer on May 11, 2026 at 5:36 am

    As with the post you references: seperating the logic from the gui elements is also the solution here.

    You should consider using a controller-like class which exposes a list of items which you can databind to your ComboBox’ DataSource. The controller itself is responsible for maintaining this list.

    So whenever you type a letter in the ComboBox you call a function on the controller, let’s say UpdateList(string typedString). In this way you have seperated the logic of filling the list with ‘candidates’.

    Now you can easily write a number of tests which each call UpdateList() with different arguments and inspect the list of items afterwards. No GUI stuff needed to do the testing, you’re only testing the algorithm itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 133k
  • Answers 133k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Sessions are significantly safer than, say, cookies. But it is… May 12, 2026 at 6:40 am
  • Editorial Team
    Editorial Team added an answer Variables are scoped normally in a view, though it can… May 12, 2026 at 6:40 am
  • Editorial Team
    Editorial Team added an answer Add lots of diagnostic SELECTS and PRINT statements. Hey, it's… May 12, 2026 at 6:40 am

Related Questions

The desired functionality of the 'enhanced' combo box is a quick find method. Each
Let's say your coworker monkeypatches the Fixnum class and redefines the + method to
I'm trying to find if there is a reliable way (using SQLite ) to
I recently saw a jQuery example where a POST was made to Default.aspx/Test, where
In the past I have used MAPISendMail to launch Outlook (or whatever the desired

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.