hamid Posted May 9, 2006 Posted May 9, 2006 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. 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 } :-\ Quote [ once4ever ]
Cags Posted May 9, 2006 Posted May 9, 2006 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. Quote Anybody looking for a graduate programmer (Midlands, England)?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.