ScrollBar.OnValueChanged Method (EventArgs)
Raises the ValueChanged event.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Raising an event invokes the event handler through a delegate. For more information, see NIB: Raising an Event.
Themethod also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors:
When overridingin a derived class, be sure to call the base class’s method so that registered delegates receive the event.
The following code example uses the derived class VScrollBar. Event handlers for the Scroll and ValueChanged events are created. This code assumes that a Label and Button have been created on a form and that the button has an event handler for the Click event. When the button is clicked, the Value property of the scroll bar is adjusted in code. The label will display the current value of the Value property and the event that changed it. You will notice that when the scroll value is changed by the button's Click event, only the ValueChanged event is raised. In contrast, when the scroll bar is scrolled manually, the Scroll event is raised immediately after the ValueChanged event.
For instructions about how to run this example in Visual Studio, see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.
Available since 1.1