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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:25:06+00:00 2026-05-12T06:25:06+00:00

First of all, I’m using VS2005 and C# 2.0. I’m trying to set a

  • 0

First of all, I’m using VS2005 and C# 2.0.

I’m trying to set a combobox’ Text property from inside the SelectedIndexChanged event. From another thread here on StackOverflow this was proposed done the following way:

BeginInvoke(new Action(() => someCombobox.Text = "x" )); 

Now, first of all this returns a compiler error for me. I believe that is because the Action object behaves differently in the two language specifications. In C# 2.0, the Action object seems to need the <T> structure in all declarations. Maybe I’m wrong, but I’d like to have that clarified.

What does work is the following:

BeginInvoke(new Action<string>( delegate { someCombobox.Text = "x"; }), new object[] { "" });

However, it just seems very weird to me that I have to define the Action object with a type parameter (especially since I’m not intending to pass any parameters)! Somehow removing this parameter would also make the empty new object[] obsolete, which is what I want.

Can anyone help me simplify the above call?

Finally, is it guaranteed that BeginInvoke will finish after the SelectedIndexChanged and thus update the combobox’ Text property with the correct text?

I’d really appreciate to learn the answers to these questions.

  • 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-12T06:25:07+00:00Added an answer on May 12, 2026 at 6:25 am

    I don’t think Action without parameters is available in .NET 2.0
    No worries – just use a different predefined delegate type.
    MethodInvoker should do the job (void method with no parameters).

    Also, BeginInvoke has 2 overloads – one that takes a delegate, and one that takes a delegate and array of objects.

    BeginInvoke(new MethodInvoker(delegate()
    {
        someCombobox.Text = "x";
    }));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all im using C# with two forms. Form1 is for combobox and
First of all, I'm quite new to the Android and JAVA world (coming from
First of all, some background: I'm trying to get in a list of integers
First all, I am still learning CakePHP and I am close to ZERO using
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built
first of all, I'm not good with jQuery and coding. I'm trying to achieve
First of all my code (largely inspired from ZMQ doc http://zguide.zeromq.org/py:mtserver ): import zmq
First of all, this isn't for a keylogger, it's for an input in a
first of all some details: I configured security as below in web.xml view plaincopy
first of all i would like to say i know its probably an easy

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.