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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:56:45+00:00 2026-05-10T17:56:45+00:00

I have a server application that receives information over a network and processes it.

  • 0

I have a server application that receives information over a network and processes it. The server is multi-threaded and handles multiple sockets at time, and threads are created without my control through BeginInvoke and EndInvoke style methods, which are chained by corresponding callback functions.

I’m trying to create a form, in addition to the main GUI, that displays a ListBox item populated by items describing the currently connected sockets. So, what I’m basically trying to do is add an item to the ListBox using its Add() function, from the thread the appropriate callback function is running on. I’m accessing my forms controls through the Controls property – I.E:

(ListBox)c.Controls['listBox1'].Items.Add(); 

Naturally I don’t just call the function, I’ve tried several ways I’ve found here and on the web to communicate between threads, including MethodInvoker, using a delegate, in combination with Invoke(), BeginInvoke() etc. Nothing seems to work, I always get the same exception telling me my control was accessed from a thread other than the one it was created on.

Any thoughts?

  • 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-10T17:56:46+00:00Added an answer on May 10, 2026 at 5:56 pm

    You have to call Invoke (or BeginInvoke) on the ListBox control you are accessing in order for the delegate to be called on the thread that created that control.

    ListBox listBox = c.Controls['listBox1'] as ListBox; if(listBox != null) {    listBox.Invoke(...); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client server application that sends XML over TCP/IP from client to
We have an application that runs over load balanced server instances, and therefore is
I have a server application that uses a lot of threads. Without wanting to
I have a client/server application that communicates with .Net remoting. I need my clients
i have a server - client application that runs on java 1.3; i want
We have a Linux server application that is comprised of a number of open-source
I have a client-server application that uses .net remoting. The clients are in a
I have a client server based windows forms application that needs an administrator only
We have an application that installs SQL Server Express from the command line and

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.