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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:07:43+00:00 2026-05-13T09:07:43+00:00

This is a problem I’ve had to deal with in my last project, and

  • 0

This is a problem I’ve had to deal with in my last project, and although I found a working solution, I wasn’t too happy with it and am wondering if there would’ve been a better, cleaner one.

Problem:

Basically, I needed to implement a ComboBox that inserts or appends an item (selected from the drop-down list) to the textbox instead of replacing all text in the textbox:

  • If the textbox has some text selected, that selection would be replaced with an item selected from the drop-down list;
  • If the textbox has no text selected, an item chosen from the drop-down list would be appended in the textbox field.

As it turned out, I could not achieve this behaviour by handling a combination of ComboBox‘s events (such as SelectedIndexChanged, SelectionChangeCommitted, TextChanged etc.) because the ComboBox control would finally synchronize the textbox field with the selected item from the drop-down list without raising any further events afterwards.

Solution, a.k.a ugly hack:

I ended up installing a Timer that, once expired, causes an update to the textbox field. The timer was set to approx. 30 ms, which should be long enough to ensure that all events (SelectedIndexChanged, TextUpdate etc.) have been processed, and short enough to not feel like a noticeable lag to the user.

Does anyone know of a cleaner solution to this problem?

  • 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-05-13T09:07:43+00:00Added an answer on May 13, 2026 at 9:07 am

    What you want is not a ComboBox. You want a text box and a button that when clicked gives you a drop down list of tokens which can be inserted into the text box. A ComboBox nearly gives you this but is unsuitable for two reasons:

    • Users known how ComboBoxes work. Your component looks like a ComboBox but doesn’t behave like one. That will just cause confusion.
    • ComboBoxes are designed in the way they are so that users will always know how they work and can be familiar with them. It is not the intention that the selected item differs from the text. You can’t override this behaviour because if you did, it would no longer be a ComboBox as we know it. Trying to override it to completely change the behavior of the control in a way for which it was not designed causes problems that are not easy to fix.

    You should write a custom control which implements the features you need and has a UI that better represents what you are doing. To look for inspiration you could consider the ‘insert emoticon’ UI that many instant messaging programs have. Notice that the button is not typically inside the text box but a completely separate button.

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

Sidebar

Related Questions

This problem pops around the network for years, I've found no good solution yet.
This problem is not readily reproducible in a simple example here but was wondering
This problem has been KILLING me. I've been working on this app for 8
This problem exists only in IE browser, in mozilla its working fine... i have
This problem may be a bug. i have spent too much time trying to
This problem is not related to struts 2. I failed to find a solution
This problem rephrases an interview question . Since this original problem seems too hard
This problem may be a bit too vast and nebulous for this space, but
This problem has been sending me insane, although admittedly I've not written SQL for
This problem has bugged me so many times and i have now decided to

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.