PC Review


Reply
Thread Tools Rate Thread

Copying an EventHandler from one resource to another one

 
 
Yoav Berenstein
Guest
Posts: n/a
 
      15th Dec 2003
I need to copy an EventHandler assigned to one resource,
to another (runtime generated) resource.

Here is the code I used :


public void test(object xi_sender)
{
System.Windows.Forms.Menu parent = (xi_sender as
System.Windows.Forms.MenuItem).Parent;
System.Windows.Forms.Label button;


for (int index = 1; index < parent.MenuItems.Count;
index++)
{
button = new System.Windows.Forms.Label();
button.Click += parent.MenuItems[index].Click;
}
}


But it will not compile. The error message is as follows :

.... (10): The event 'System.Windows.Forms.MenuItem.Click'
can only appear on the left hand side of += or -=


How can I acomplish this task ?

Thank you,
Yoav
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying public calendar to new resource calendar Cathy C Microsoft Outlook Calendar 0 29th Mar 2006 07:32 PM
Failed to load resource from resource file. Plese check up your setup Andry Microsoft Dot NET Framework 0 22nd Nov 2005 07:52 AM
Adding an embedded resource without copying it? Wysiwyg Microsoft ASP .NET 0 3rd May 2005 11:15 PM
System.ArgumentException: [Resource lookup failed - infinite recursion detected. Resource name: Argument_AddingDuplicate__] Roz Lee Microsoft Dot NET 0 4th Feb 2005 01:57 AM
can I call getString() to get a string from a separate resource file instead of embedded resource? babylon Microsoft Dot NET Framework 2 7th Oct 2003 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:56 AM.