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

The Archive Base Latest Questions

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

I am receiving a struct from a server app and when the client program

  • 0

I am receiving a struct from a server app and when the client program gets it and its the type of serverInfo it sends it to a functions and sets the server info to labels. I have put MessageBox.Show() on both ends to see whats wrong and the first one pops up but the second doesnt. The first messagebox shows the info from the struct recived from the server and its all correct so i know that works. I have also put a Message box between each of the label.text = text and they didnt show. I also tried just putting “this is a test string” on them and they still didnt do anything.

Edit* this is WinForms

Edit* I found out that it is a cross threading problem so whats a good way to change labels from another thread?

private void onServerInfo(msgBox message)
{
    serverInfo.info info = (serverInfo.info)message.getMessage("info");
    MessageBox.Show(info.name + " ; " + info.type + " ; " + info.limit); // works with everything showing up right
    ServerName.Text = info.name; //this is a string
    ServerType.Text = info.type.ToString(); // this is a enum
    MaxLimit.Text = info.limit.ToString(); // this is a int
    MessageBox.Show(ServerName.Text + " ; " + ServerType.Text + " ; " + MaxLimit.Text); // doesnt ever show
}
  • 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-30T09:56:14+00:00Added an answer on May 30, 2026 at 9:56 am

    Since your exception is caused by a cross-threading access exception, use this handy method to fix that:

    https://stackoverflow.com/a/2242393/555547

    So edit your class to be like:

    /// <summary>
      /// Extension method that allows for automatic anonymous method invocation.
      /// </summary>
      public static void Invoke(this Control c, MethodInvoker mi)
      {
         c.Invoke(mi);
    
         return;
      }
    
    
    private void onServerInfo(msgBox message)
    {
    this.Invoke
    (
       () =>
       {
        serverInfo.info info = (serverInfo.info)message.getMessage("info");
        MessageBox.Show(info.name + " ; " + info.type + " ; " + info.limit); // works with everything showing up right
        ServerName.Text = info.name; //this is a string
        ServerType.Text = info.type.ToString(); // this is a enum
        MaxLimit.Text = info.limit.ToString(); // this is a int
        MessageBox.Show(ServerName.Text + " ; " + ServerType.Text + " ; " + MaxLimit.Text); // doesnt ever show
       }
    );
    }
    

    Though for good practice, you should really put that extension method in it’s own file called ControlExtensions.cs and call it from there.

    Edit: Actually, you must put that extension method in it’s own static class or you’ll get an error.

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

Sidebar

Related Questions

I'm receiving a struct over a network from a C server to my Python
I have a server and a client program (both running on the same machine).
I've been trying to send a packet from a client to a server via
I am receiving the following error from my WCF Client. The address of the
I'm receiving feedback from a developer that The only way visual basic (6) can
My application is receiving email through SMTP server. There are one or more attachments
I'm receiving suddenly this error on a Win2003 Server Web Application: Microsoft VBScript runtime
Based from the answers I got from this thread , I've created this: //Server
I'm trying to get an MX record from an DNS server in C. My
I have a python program that is supposed to connect to a server 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.