fylix0000
asked on
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:
((CAD_APP.CADScreens.frmCm dLog)(send er)).CmdLo gFileDict
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.frmCm dLog)(send er)).CmdLo gFileDict
}
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,
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:
((CAD_APP.CADScreens.frmCm
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.frmCm
}
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,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
not a problem - glad you figured it out.
ASKER
Thanks p_davis for trying to assist me.