?
Solved

State Changes

Posted on 2006-04-19
4
Medium Priority
?
201 Views
Last Modified: 2010-04-16
Hi,

I have a project class which fires several onChange events which I would like to display asynchronously to another window form project using VS.NET 2005. How can I do that?

Thanks,

Yama
0
Comment
Question by:yamazed
  • 2
  • 2
4 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 16495212
Maybe you can give some details. Without this I try to guess:

http://msdn.microsoft.com/msdnmag/issues/06/04/ManagedSpy/
0
 

Author Comment

by:yamazed
ID: 16495491
Not even close... Here is what I am trying to accomplish:

Say I had the following:

In a class project:

myClass_OnChange(object sender, EventArg e)
{
   myStringBuilder.Append(e.Results);
}

myClassWithinthesameClass_OnChange(object sender, EventArg e)
{
   myStringBuilder.Append(e.Results);
}

I'd like to display results in a textbox on a windows form.

Such that everytime a change happens in class project I display it in the textbox.

Thanks,

Yama
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 1500 total points
ID: 16495657
Raise event from the class and handle it in the form.

Class code:

public delegate void NewStringHandler(string s);

public class myClass
{
    public event NewStringHandler OnNewString;

    myClass_OnChange(object sender, EventArg e)
    {
       myStringBuilder.Append(e.Results);
       // raise event
       OnNewString(e.Results);
    }
}

In form class:

myClass m = new MyClass();
m.OnNewString += new NewStringHandler(this.OnNewString);   // subscribe to event

void OnNewString(string s)
{
    // handle event
}
0
 

Author Comment

by:yamazed
ID: 16502552
Hi,

I am getting a null thrown when:

 // raise event
OnNewString(e.Results);

OnNewString is null...

Yama
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question