Solved

Configure EventHandler with string

Posted on 2008-06-19
4
401 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now