Hi friends i have some problem in understanding a particular line of my code in VB.NET and I am new to VB.NET . Can any one please do explain this to me?


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

What does ByVal mean here?

Recommended Answers

All 3 Replies

In short, ByVal means pass the value of the variable that was provided as input to the method. This is as compared to ByRef, which is a "pointer" to the variable itself, which basically means if you modify that ByRef variable, you change the value of that variable outside of the scope, too, like in the method that called your function.

Specifies that an argument is passed in such a way that the called procedure or property cannot change the value of a variable underlying the argument in the calling code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.