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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:16:53+00:00 2026-06-13T08:16:53+00:00

After following the MSDN guide to create a new thread to update a UI

  • 0

After following the MSDN guide to create a new thread to update a UI control I’m getting a strange error. I had this same query run in the load method and it worked just fine, now running in the new thread I get the right number of results, but instead of getting the names of the fields I just get DataSet written 16 time in my comboBox. Can anyone help me with this?

private void Form1_Load(object sender, EventArgs e)
    {
        recipeListComboBox.Items.Clear();
        Thread QueryThread = new Thread(new ThreadStart(updateRecipeList));
        QueryThread.Start();
    }

 private void updateRecipeList()
    {

        IEnumerable<string> list = recipeList.getList();

        foreach (string a in list)
            UpdateRecipeComboBox(a);
    }

 private void UpdateRecipeComboBox(string text)
    {
        if (this.recipeListComboBox.InvokeRequired)
        {
            UpdateRecipeComboBoxCallBack d = new UpdateRecipeComboBoxCallBack(UpdateRecipeComboBox);
            Invoke(d, new object[] { text });
        }

        else
        {
            this.recipeListComboBox.Items.Add(Text);
        }
    }

    delegate void UpdateRecipeComboBoxCallBack(string text);

before I put this on a new thread it looked like this:

private void Form1_Load(object sender, EventArgs e)
{
     recipeListComboBox.Items.Clear();
     IEnumerable<string> list = recipeList.getList();

     foreach (string a in list)
          recipeComboBox.Items.Add(a);

this would retrun a list of 16 different recipies in the database, now I just get dataSet printed 16 times.

Thanks for any help!!

Craig

  • 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-13T08:16:55+00:00Added an answer on June 13, 2026 at 8:16 am

    If you’re getting "DataSet"printed over an over again I’m guessing that somewhere you’re using a DataSet object in place of a string parameter and it’s calling object.ToString() automatically which returns the name of the class.

    Not sure if it’s your problem but you also have a casing mismatch here:

    private void UpdateRecipeComboBox(string text)
    {
        if (this.recipeListComboBox.InvokeRequired)
        {
            UpdateRecipeComboBoxCallBack d = new UpdateRecipeComboBoxCallBack(UpdateRecipeComboBox);
            Invoke(d, new object[] { text });
        }
    
        else
        {
            this.recipeListComboBox.Items.Add(Text);  // <--- should be text???
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been following this guide from MSDN about Creating an ASP.NET MVC Areas Application
I have followed this tutorial to create the first azure application http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_IntroToWindowsAzureLabVS2010 Because after
After following the RoR getting started tutorial, I added another model as: $ rails
After following the great advice given in a thread about service beans I have
After following this MVC 4 tutorial series I was trying some of the stuff
After following the steps outline in this Fluent NHibernate tutorial I am stuck on
I would like help with the following asp.net error i now have after deploying
Update: here is an MSDN article How to: Make Thread-Safe Calls to Windows Forms
I'm following the directions here: http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/0ce70e04-0ba0-4819-8898-87243203adb9/ to support mapping to a view that uses
After reading the following article Create Test Conditions for the Database Unit Test Designer

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.