Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

How can a descendant UserControl intercept events fired by its base class

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.33 KB  |  views: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public event EventHandler OkClick;
  2. protected virtual void OnOkClick(EventArgs e)
  3. {
  4.     if (OkClick != null) OkClick(this, e);
  5. }
  6.        
  7. OnOkClick(EventArgs.Empty);
  8.        
  9. protected override void OnOkClick(EventArgs e)
  10. {
  11.     // do some stuff before the event is fired
  12.     base.OnOkClick(e);
  13.     // do some stuff after the event is fired
  14. }