c# - App-wide Context Menu -


i have created context menu text-box in .net application, , works great. use same context-menu text-boxes in application. currently, using code following work existing functionality:

private void contextmenustrip1_opening(object sender, system.componentmodel.canceleventargs e) {         // disable undo if canundo property returns false         if (maintextbox.canundo)         {             contextmenustrip1.items["undo"].enabled = true;         }         else         {             contextmenustrip1.items["undo"].enabled = false;         } } 

my question how go converting code text-boxes can use same code, rather rewriting on , on again text-box instances. have assigned same contextmenu of text boxes, more specifically, how pass name of calling text-box function? hoping simple perhaps:

// disable undo if canundo property returns false if (this.canundo) {    contextmenustrip1.items["undo"].enabled = true; } else {    contextmenustrip1.items["undo"].enabled = false; } 

unfortunately, isn't working. ideas?


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -