check function availability

hamid

Centurion
Joined
Jul 13, 2004
Messages
114
my MDI application create menu dynamicaly from a database.
it get menu names and create them and add them to mainmenu of my mdi app.
for each menu i add event that come up its name.
in this case add event "name1_click" to menus that named "name1"
but if there isn't any function with this address "name1_click" debuger return error that there is this function.
ok. how can i check availability of this function before add event?

i need a function that get a string and return true if there was a function with it string.

Code:
private bool isfunction(string funcName)
{
   if(there is function as name funcName)
      return true;
   else
      return false
}
private addEventToMenu(string menuName)
{
   Menu newmenu = ....
   //after create menu
   
   if(isfunction(menuName+"_Click"))
       .... add event menuName+"_Click" to newmenu
   else
       add defaultMenu_Click to newmenu
}
:-\
 
To the best of my knowledge this isn't possible. You would be better off having a single function for all menu's that has a switch statement based on the menu name.
 
Back
Top