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

  • SEARCH
  • Home
  • 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 8676461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:12:12+00:00 2026-06-12T20:12:12+00:00

I have an editable ComboBox that should contain a path. The user can select

  • 0

I have an editable ComboBox that should contain a path. The user can select several default paths (or enter his own) from a dropdown list, such as %ProgramData%\\Microsoft\\Windows\\Start Menu\\Programs\\ (All Users). The items in the dropdown list contain a short explanation, like the (All Users) part in the former example. Upon selection of such an item, I want to remove this explanation, so that a valid path is displayed in the ComboBox.

I currently strip the explanation out of the string and try to change the text via setting the Text property of the ComboBox. But this doesn’t work, the string is parsed correctly, but the displayed text won’t update (it stays the same as in the dropdown list, with the explanation).

private void combobox_TextChanged(object sender, EventArgs e) {
            //..             

               string destPath = combobox.GetItemText(combobox.SelectedItem);                  
               destPath = destPath.Replace("(All Users)", "");                   
               destPath.Trim();                   
               combobox.Text = destPath; 

            //..
}
  • 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-12T20:12:14+00:00Added an answer on June 12, 2026 at 8:12 pm

    I found the solution in a similar question, by using BeginInvoke()

    Using Nikolay’s solution, my method now looks like this:

    private void combobox_SelectedIndexChanged(object sender, EventArgs e) {
                if (combobox.SelectedIndex != -1) {
                    //Workaround (see below)
                    var x = this.Handle;
                    this.BeginInvoke((MethodInvoker)delegate { combobox.Text = combobox.SelectedValue.ToString(); });                  
                }
    }
    

    The workaround is required, since BeginInvoke requires the control to be loaded or shown, which isn’t necessarily the case if the program just started. Got that from here.

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

Sidebar

Related Questions

I have a combobox and it's editable. So the user can select an item,
I have an activity that contains several user editable items (an EditText field, RatingBar,
Ok. I have an editable div into which I can enter some text. However
I have an editable WPF ComboBox with TextSearchEnabled. I need to force the user's
I have an editable UITextField that takes input from the user. I need to
I have an editable ComboBox: <ComboBox IsEditable=true/> What is the event that is raised
I have an editable ComboBox component and I want to reference the TextInput that
I have an editable JTable . If a user is editing a cell when
I have a Listbox where all cells are editable. While the user is typing
I have a ComboBox that is bound to an ObservableCollection of custom UserControls. Each

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.