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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:44:10+00:00 2026-05-26T22:44:10+00:00

I am currently developing a WCF Publish Subscribe service. The subscriber is a winform

  • 0

I am currently developing a WCF Publish Subscribe service. The subscriber is a winform app. As the subscriber needs to implement the callback method for the service, which in my case is the PostReceived() method, and the publisher has the PublishPost() method.

For the PostReceived() method for my winform, it is unable to access the UI thread of my winform. The subscribe method is done on my main method. How do I program my PostReceived() method in such a way that it is able to access the labels and such of my mainForm?

EDIT

what I have tried so far is calling the mainForm object from my program.cs but it crashes when i run all 3 , stating the error that it is unable to access the UI thread.

EDIT 2

I have tried using the following code but there is an error for it.

mainForm b;   
public void PostReceived(string postSampleData)
    {
        b.BeginInvoke((MethodInvoker)delegate()
        {
            b.lblSearch.Text = "lakjslkaja";
        });

After running the code, there is an error of

Object reference not set to an instance of an object.

Any idea how to fix it?

  • 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-26T22:44:11+00:00Added an answer on May 26, 2026 at 10:44 pm

    Your PostReceived method should be something like this

    void PostReceived()
            {
                yourform.BeginInvoke((MethodInvoker)delegate()
                    {
                        yourform.button.Text = "new label";
                        //More stuff here
                    });
            }
    

    This will guarantee that all the stuff after BeginInvoke is invoked in the UI thread.

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

Sidebar

Related Questions

I am currently developing a WCF publish subscribe service on a winform app. How
i am currently developing a wcf publish subscribe service. On my windows form app,
I am currently developing a WCF Publish Subscribe service. My Service has the following
I am currently developing a WCF publish subscribe service. Is it possible for the
I am currently developing a WCF Publish Subscribe Service. The publisher would be a
I am currently developing a asp.net webpage and a WCF publish subscribe service. The
I am currently developing a WCF Publish Subscribe service on a windows form application.
I am currently developing a WCF publish subscribe service for my asp.net publisher and
I am currently developing a WCF Publish Subscribe service in a windows form project.
I am currently developing a WCF duplex service and I am trying to implement

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.