CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Aug 2009
    Posts
    20

    need help with cross-thread delagates

    hi, i have went through countless examples of how to use delegates, and still no success
    here is my problem:

    WFA application
    Code:
    //myClassA.cs
    class myClassA 
    {
         private AddLabel(string text) // add few labels on the Panel which is placed on the form
         {
               // got ref to panel 'p' so i just call
               p.Controls.Add( //my new label);
         }
    }
    Code:
    //myClassB.cs
    class myClassB 
    {
          public void OnDataReceived // receiving data from socket, new thread
         {       
              now i need to call method from myClassA - AddLabel("some text")
              to add new label on the panel,   how ?
         }
    }
    Code:
    //Form1.cs
    public partial class Form1 : Form
    {
          private myClassA objA;
          private myClassB objB;
    
         // i can call objA.AddLabel and its working fine, but i need to call that method inside myClassB
    }
    Last edited by sv13; January 16th, 2010 at 02:54 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured