hi there,

how can i call the cbPW_TextChanged event in another function

thanxxxxxxx

Recommended Answers

All 3 Replies

hi there,

how can i call the cbPW_TextChanged event in another function

thanxxxxxxx

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

thanxxxxx

commented: You missed that point in OP. -2

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.