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
Solved

Configure EventHandler with string

Posted on 2008-06-19
4
404 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 our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

792 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