I am trying to learn Visual Basic and am working through a text book that my son used for a class. Each time I create an event handler by double clicking on the design page, the code that automatically populates is almost identical to the code in the book, except the byval portion is omitted from the code. Can someone explain to me why this happens. I have included an example of the book code and the code I end up with below.
Private Sub frmConversion_Load(sender AS System.Object, e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub frmConversion_Load(ByVal sender AS System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Looking at the Form.Load
Event in MSDN it shows the event in the style of your second example.
It looks like according to this Microsoft.Connect request page the earlier versions of Visual Studio put in the ByVal, but since it is the default it was removed in Visual Studio 2010 SP1. The answer to your question is the example code in the book was created with an older version of Visual Studio.