8 Years
Discussion Span
Last Post by nick.crane

hi there,

how can i call the cbPW_TextChanged event in another function


hey does anybody knows how to attach and detach the combo box Text_Changed event


Votes + Comments
You missed that point in OP.

An event method is just another method. Call it as you would any other method.

If you don't use the parameters in your code then you can use null place holder.
E.G cbPW_TextChanged(null, null); If you use the sender or event arg parameters then you must supply appropriate objects so your code will work.
E.G. cbPW_TextChanged(cbPW, new EventArgs());


To attach and detach a method you use the += and -= operators.

// attach handler
cbPW.TextChanged += new EventHandler(cbPW_TextChanged);
// detach handler
cbPW.TextChanged -= new EventHandler(cbPW_TextChanged);

To find out what the handler syntax is, add the event handler in the normal way and then right click on the method name and select Find All References. One of them will be a reference to the designer code and use the += operator to attach your method.

Edited by nick.crane: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.