|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi everybody !
Who may solve this problem out : What is the value of c, after execution of the followong Code sample??: *********** Dim c As Integer c = 1 CheckValue(c) ... Sub CheckValue(ByVal iValue As Integer) ... iValue = 13 End Sub ************ Thank you .. ! DEBRUYNE URL |
|
#2
|
|||
|
|||
|
c still equals 1. If you want to change c to be 17 in the function, pass it ByRef, or make the CheckValue a function with a return type. Based off your post, you want to do this:
Sub CheckValue(ByRef iValue as Integer) Passing ByRef passes the object, passing ByVal passes the Value of the object. HTH, Tibby |
|
#3
|
|||
|
|||
|
support...
Quote:
yeah tibby is right...even c assign a value of 1. When you pass to the Sub CheckValue(ByVal iValue As Integer)... the iValue now is 1 which you pass, but in the method, you assign iValue which is equal to 13, you have a new value stored in iValue, so after the execution, still c is equal to 1 and your iValue is 13... unless you make a function which return a value that makes c change... |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Code Output ..!: |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|