May 25, 2005 #1 T ThienZ Freshman Joined Feb 10, 2005 Messages 45 Location Germany Hi, is it possible to remove or turn an event off (and then on) from a control? I add an event like this : C#: this.KeyPress += new KeyPressEventHandler(TextBoxMaxNr_KeyPress); How can i turn it on/off ? Thx in advance
Hi, is it possible to remove or turn an event off (and then on) from a control? I add an event like this : C#: this.KeyPress += new KeyPressEventHandler(TextBoxMaxNr_KeyPress); How can i turn it on/off ? Thx in advance
May 25, 2005 #2 S stustarz Junior Contributor Joined Jan 10, 2003 Messages 246 Location Earth Without having the IDE in front of me im sure the syntax is something like : Code: this.KeyPress -= KeyPressEventHandler;
Without having the IDE in front of me im sure the syntax is something like : Code: this.KeyPress -= KeyPressEventHandler;
May 25, 2005 #3 S snarfblam Ultimate Contributor Joined Jun 10, 2003 Messages 2,097 Location USA I think you do it like this: Code: this.KeyPress -= new KeyPressEventHandler(TextBoxMaxNr_KeyPress); Create the new delegate, and use the -= operator to have that function removed from the list of handlers.
I think you do it like this: Code: this.KeyPress -= new KeyPressEventHandler(TextBoxMaxNr_KeyPress); Create the new delegate, and use the -= operator to have that function removed from the list of handlers.