Quote
EDIT: But for future reference, what exactly is e? Thats the only part of the code i don't quite understand.
Hi,
Most events have two parameters that are passed to them. For example, the Click event:
Private Sub SearchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchButton.Click
End Sub
By convention, "sender" is the variable used to define which object generated the event. So in this example, the sender variable references the SearchButton that I have on my form.
By convention, "e" is the variable used to define any arguments for the event. Depending on the event, e can have any number of properties and methods.
For example the Load event and Click event "e" variable has a basic set of properties/methods. The FormClosing event "e" variable has additional properties and methods such as the e.Cancel.
What e.Cancel does depends on the event. For example, in the FormClosing event, e.Cancel will prevent the form from closing, basically cancelling the close request.