Solved

Configure EventHandler with string

Posted on 2008-06-19
4
406 Views
Last Modified: 2013-12-16
Hi EE's

I'm facing following problem. I have to configure the EventHandler of a ToolStripButton with a string (or any other object) coming from a XML. How can I give the corresponding dll, class and function to the EventHandler?

An example:
I have a dll called MyOwnMenu.dll
In this dll I have a class called MyMenuItem1
In this class I have a (static) function called MyToolStripCall
In my main application I add an ToolStripButton
ToolStripButton myMenuButton = new ToolStripButton("myText", null, new EventHandler(XXX));

"myText" comes out of a XML and also the function to call (XXX) should be named in the xml.

Thanks a lot!
0
Comment
Question by:Bruce_1975
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:elimesika
ID: 21824057
0
 
LVL 6

Author Comment

by:Bruce_1975
ID: 21824655
Hi elimesika,
the reflection stuff is not really new to me. What I'm looking for is a solution to give a function to an event handler. Do I have to call a Callback function and access the target function from there?
Or is there an other way to directly call the function from the event handler?

Regards,
Bruce
0
 
LVL 19

Accepted Solution

by:
elimesika earned 500 total points
ID: 21828894
HI

I don't see any other option except constructing a string with DLL, class name, method and call it using reflection.

0
 
LVL 6

Author Closing Comment

by:Bruce_1975
ID: 31468810
Thanks for your help.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question