Calling Events

  • Thread starter Thread starter Kiran
  • Start date Start date
K

Kiran

Hi,

I would like to call a checkbox's checked changed event from another event.

Ho can I do this.

Thanks
Kiran
 
You can't call an event from outside the class directly. This is up to the
object to do itself, as it's the one that's supposed to know if it's appropriate.


I think what you want is to factor out whatever you've put into the changed
event handler into a seperate method and call that from the change event.
Then this allows you to call the behavior code from elsewhere i n your app/page.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Kiran,

You can call an event handler the way you call any other method. Just pass
in null (or Nothing if you are using VB.NET) for the parameters.

i.e.

private void Button1_Click(object sender, System.EventArgs e)
{
CheckBox1_CheckedChanged(null, null)
}
 
Back
Top