Frank Freese
asked on
Different sub statements
Experts,
In my learning VB when I create a button the following code is created:
In my learning VB when I create a button the following code is created:
Private Sub Button1_Click(sender As System.Object,
e As System.EventArgs) Handles Button1.Click
End Sub
However, when I look at the exmaples from the book I'm using I see this Private Sub Button1_Click(ByVaL sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
End Sub
The book adds the ByVal. Do I need to change some default(s)?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you do not include ByVal it is assumed by the system. If you want to use ByRef then you need to specify it. You cannot add both. To specify ByRef you would use something like
Private Sub (ByRef myVariable as string)
Note - Understanding reference and value types can be very important, especially when dealing with objects
Here is good discussion
http://www.vbforums.com/archive/index.php/t-612831.html
Michael
Private Sub (ByRef myVariable as string)
Note - Understanding reference and value types can be very important, especially when dealing with objects
Here is good discussion
http://www.vbforums.com/archive/index.php/t-612831.html
The difference between value types and reference types, in the most basic form, is that value types hold their data directly, while reference types point to a location in memory, and the data is located in that memory.
Michael
ASKER
thank you
ASKER