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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:34:01+00:00 2026-05-11T13:34:01+00:00

Note : Part of a series: C#: Accessing form members from another class and

  • 0

Note: Part of a series: C#: Accessing form members from another class and How to access form objects from another cs file in C#.


Hello,

The Idea is to notify the user using the memo when a packet is received/sent in a TCP Client.

After couple of fixes,the most suitable solution seemed to be this one

    public string TextValue     {         set         {             this.Memo.Text += value + '\n';         }     } 

That’s how it’s being called

    var form = Form.ActiveForm as Form1;     if(form != null)         form.TextValue = 'Test asdasd'; 

However,calling the code throws an exception ,because of Unsafe thread call.I found a solution at msdn,but I can’t seem to acquire the method they’ve used there.

This is my remake,which doesn’t work.

    private void SetTextMemo(string txt)     {         if(this.Memo.InvokeRequired)         {             this.Invoke(SetTextMemo,txt); //error here         }         else         {             this.Memo.Text += txt + '\n';         }     } 

errors:

Argument ‘1’: cannot convert from ‘method group’ to ‘System.Delegate’

Argument ‘2’: cannot convert from ‘string’ to ‘object[]’

Basically,I’m trying to access the Memo(or more likely said,add text to the memo) from another thread using Invoke.I never used it before,maybe that’s why I misunderstand my mistake.

  • 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-11T13:34:02+00:00Added an answer on May 11, 2026 at 1:34 pm

    The easy way is:

    this.Invoke((MethodInvoker)delegate {     this.Memo.Text += txt + '\n'; }); 

    Which uses an anonymous method to do the job inline. Since you expect to be on another thread, you may as well just call Invoke – it is safe even from the UI thread.

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

Sidebar

Related Questions

Here's part of my Note class: class Note attr_accessor :semitones, :letter, :accidental def initialize(semitones,
Note: this was inspired by WebBrowser Event Properties? Why am I able to access
Note: This question has broadened in scope from previous revisions. I have tried to
Note: I'm using Windows file servers and .NET If I were to create a
Hello I have an api response in xml format with a series of items
I have a page that contains a form, where part of it is dynamically
Note : The code in this question is part of deSleeper if you want
See this image: http://i56.tinypic.com/311vw51.png You will note that part of the border of image
NOTE: I added my new solution at the UPDATE answer below. I try to
Note: Although my particular context is Objective-C, my question actually transcends programming language choice.

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.