Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Configure EventHandler with string

Posted on 2008-06-19
4
Medium Priority
?
413 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

773 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