Access Object sender 's properties or object on an event.

Hi all,

I have a close window A event that get executed in window B as follow:

    void window_AClosed(object sender, FormClosedEventArgs e)

When I run this event in debug mode, i can see the object sender has an item from window A that  I like to use in window B.  So I looked at the expression of that object and I got the following:


So after including the namespace and such I thought it will be easy as doing the following:

    void window_AClosed(object sender, FormClosedEventArgs e)
      string n= ((CAD_APP.CADScreens.frmCmdLog)(sender)).CmdLogFileDict

However, I keep getting syntax error because my sender object does not recognize that during compilation.  I am new to C# so after reading around I see the concept of "reflection" so my question is how can I access CmdLogFileDict, do I need to do something else or am I heading into the right direction by looking up on reflection?

Thank you,

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

what was the error? is cmdlogfiledict a string?

you should be able to do this

((CAD_APP.CADScreens.frmCmdLog) sender).CmdLogFileDict.ToString();

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
fylix0000Author Commented:
My college prof will be in regret mode for giving me passing grade if he knows this.  This is is my stupidities, I happened to declare CmdLogFileDict private >.<, changing it to public and it is all good.

Thanks p_davis for trying to assist me.
not a problem - glad you figured it out.
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

From novice to tech pro — start learning today.