Possible Duplicate:
Create event handler for OnScroll for web browser control
I would like to create an event handler for a web browser control scrolling.
webCompareSQL.Document.Window.Scroll
Can some one show me how to create an event handler?
Possible Duplicate:
Create event handler for OnScroll for web browser control
I would like to create an event handler for a web browser control scrolling.
webCompareSQL.Document.Window.Scroll
Can some one show me how to create an event handler?
In the class you add a delegate and an event, and usually a simple internal method that checks for null and calls the event:
public delegate void ScrollHandler();
public event ScrollHandler Scrolled;
internal void OnScrolled()
{
if (this.Scrolled != null)
this.Scrolled();
}
Then in the actual code you would register a method for the event using:
MyClass.Scrolled += new ScrollHandler(MyMethod);
void MyMethod()
{
Console.WriteLine("It was scrolled.");
}