State Changes

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
yamazedAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
Maybe you can give some details. Without this I try to guess:

http://msdn.microsoft.com/msdnmag/issues/06/04/ManagedSpy/
yamazedAuthor Commented:
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
AlexFMCommented:
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
}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
yamazedAuthor Commented:
Hi,

I am getting a null thrown when:

 // raise event
OnNewString(e.Results);

OnNewString is null...

Yama
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.