Problem solve Get help with specific problems with your technologies, process and projects.

Passing ByVal and ByRef

Even if you pass an "object" ByVal, it is really passed ByRef.

Please let other users know how useful this tip is by rating it below. Do you have a tip or code of your own you'd like to share? Submit it here for your chance to win a free .NET programming book in our monthly tip contest!


Even if you pass an "object" ByVal, it is really passed ByRef. In the example below, the background color of the textbox that was passed with be change to red and the value will persist after the sub completion.

Protected Sub example (ByVal txt as TextBox)

txt.BackColor = Color.Red End Sub


Dig Deeper on Win Development Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

Close