Issue resolving Sender and e


i've got mdi parent window (archaic technology, know, still gotta support it) menu has able respond changes made on child forms.  controls have selected text, instance, notify edit menu items in order toggle menus' enabled settings.  i'm attempting simplify code creating edit functions in mdi window, , having each control pass sender , eventargs parameters functions. 

problem though have object sender , eventargs e in definition these methods, parameter names not resolve in function body.  inside try block, mention of these results in compiler warning (and of course code won't compile) of form "type or namespace 'sender' not found."  above try block, within function body, names resolve, until involve them in expression such "var t = typeof(sender)".

i'm using visual studio 2010 sp1.  known issue vs, or doing wrong?  there reason why these parameter / names valid in event handler, not in function called event handler (passing parameters through it)?

 

hi, think mean is:

you can use 

private void button_click(object sender, routedeventargs e)
{

type t = sender.gettype();

...

but don't know why cannot use:

private void button_click(object sender, routedeventargs e)
{

type t = typeof(sender);

...

please see below link typeof:

http://msdn.microsoft.com/en-us/library/58918ffs.aspx

typeof takes type name, "sender" parameter name not type name, cannot use typeof(sender)



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'