Print Page | Close Window

What do these mean, please?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=31041
Printed Date: 20 July 2019 at 6:30am
Software Version: Web Wiz Forums 12.01 - http://www.webwizforums.com


Topic: What do these mean, please?
Posted By: Blueie
Subject: What do these mean, please?
Date Posted: 23 June 2014 at 3:56am
Hello

In an expression such as this: 

Protected Sub CreateUser_Click(ByVal sender As Object, ByVal e As System.EventArgs), what do these actually mean, or represent, please:

ByVal sender As Object, ByVal e As System.EventArgs

and that little 'e'?

Can (ByVal sender As Object, ByVal e As System.EventArgs), be broken up into:

1) ByVal sender As Object
2) ByVal e As System.EventArgs

I am trying to understand what these mean to a Windows computer in the .NET environment. In human-speak, what are they telling the computer to do?

Thanks!

Blueie



Replies:
Posted By: Smurfette
Date Posted: 21 July 2015 at 10:59am
In VB, you can pass arguments by value or by reference (ByVal or ByRef).
 
There's a pretty good explanation of the difference here: https://msdn.microsoft.com/en-us/library/ddck1z30.aspx. Basically, ByVal prevents those variables from being changed by the procedure you are calling. The structure of this procedure indicates that it is a Webforms project and that this automatically-generated sub is called on the click event of a button called "CreateUser". It contains two arguments.
 
Byval sender as Object is the first argument. "Sender" is the object (in this case, the button) that raised the click event.
 
ByVal e as System.EventArgs is the second argument, where "e" is the event data. This gives an overview of the structure of the EventArgs class: https://msdn.microsoft.com/en-us/library/system.eventargs(v=vs.110).aspx
 
I know this is an old thread, so you probably know this by now Tongue
 
 


Posted By: Blueie
Date Posted: 21 July 2015 at 6:21pm
Hello Smurfette
Many thanks for your reply and explanation.
 
I will take a look at those links you have kindly provided.
 
No, I didn't know it. You are the first one to explain!
 
Thanks again.
 
Blueie
 
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.01 - http://www.webwizforums.com
Copyright ©2001-2018 Web Wiz Ltd. - https://www.webwiz.net