473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ByVal var As String

Hello,

What is the difference between using in a function:

Sub Change_Culture(ByVal newCulture As String)

Or

Sub Change_Culture(newCulture As String)

The difference is the ByVal.

Thanks,
Miguel

Nov 19 '05 #1
4 1003
There is none. parameters are passed by value by default. In previous
version of VB the default was ByRef.

Actually, there is 1 difference: readability. Those unfamiliar with VB.Net
might not know what the default bahaviour is, hence you should always put
it.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
Hello,

What is the difference between using in a function:

Sub Change_Culture(ByVal newCulture As String)

Or

Sub Change_Culture(newCulture As String)

The difference is the ByVal.

Thanks,
Miguel

Nov 19 '05 #2
Nothing - except clarity.

ByVal is the default in .NET. To be as clear as possible, you should
specify ByVal (especially when working with developers coming recently from
classic VB where the default was ByRef).

David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter

"Shapper" wrote:
Hello,

What is the difference between using in a function:

Sub Change_Culture(ByVal newCulture As String)

Or

Sub Change_Culture(newCulture As String)

The difference is the ByVal.

Thanks,
Miguel

Nov 19 '05 #3
They are functionally identical since parameters are ByVal by default.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
Hello,

What is the difference between using in a function:

Sub Change_Culture(ByVal newCulture As String)

Or

Sub Change_Culture(newCulture As String)

The difference is the ByVal.

Thanks,
Miguel

Nov 19 '05 #4
Thanks,

I wasn't sure but the truth is that the effect was the same using ByVal
or Not.

Thanks once again,
Miguel

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:St***@Orr.net:
They are functionally identical since parameters are ByVal by default.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
Hello,

What is the difference between using in a function:

Sub Change_Culture(ByVal newCulture As String)

Or

Sub Change_Culture(newCulture As String)

The difference is the ByVal.

Thanks,
Miguel


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Scott M. | last post by:
If I pass a reference type ByVal, am I making a copy of the object on the heap or am I making a copy of a pointer to the object on the heap? If I pass a string object (reference type) into a sub...
4
by: Warren Sirota | last post by:
Hi, Please let me know if I am interpreting this correctly. I've done a little testing of the difference between passing parameters byVal and byRef, and the results were slightly non-intuitive,...
2
by: Witold Iwaniec via .NET 247 | last post by:
It seems that when you pass an object to a function it is always passed by reference even if it is explicitly declared ByVal. Is it the behavior of VB.Net? Here is sample code from sample Asp.Net...
7
by: Monty | last post by:
Silly question: If I return an object from a property, is it returned ByRef or ByVal? Is there a way to specify one way or the other? For instance, will the code that calls the MyObject() property...
2
by: Garima12 | last post by:
I am writing following code to fetch the data from database, using stored procedure. problem is it is highlighting ByVal and when I mouse over, it is displaying expression expected. Please anyone...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.