473,396 Members | 2,011 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,396 software developers and data experts.

Subroutine not returning any values

I have this code in VB.NET (VS 2005):

Module kvitteringFunk
Public Sub skrivKvittering()
Dim KvittPrt As String = ""
Dim iType As Byte = 0
KvittPrtType(iType, KvittPrt)
' iType should now have the value 1 - BUT IS STILL 0!?!?!?!?!?
' KvittPrt should now have the value "Common" - but is still
"".?!?!?!?!
....
End Sub

Public Sub KvittPrtType(ByVal iType As Byte, ByVal KvittPrt As String)
iType = 1
KvittPrt = "Common"
End Sub
End Module

Why is my subroutine KvittPrtType not returning any values?????

Kjell Weding
Norway
Aug 24 '07 #1
1 1259
You confused ByVal and ByRef keywords.

http://msdn2.microsoft.com/en-us/lib...30(VS.71).aspx states :
"Passing an argument by value means the procedure cannot modify the contents
of the variable element in the calling code underlying the argument. Passing
by reference allows the procedure to modify the contents in the same way
that the calling code itself can."

You may want to read the language spec at least once.

--
Patrice

"Kjell Weding" <kj***@innlandet-it.noa écrit dans le message de news:
uA**************@TK2MSFTNGP03.phx.gbl...
>I have this code in VB.NET (VS 2005):

Module kvitteringFunk
Public Sub skrivKvittering()
Dim KvittPrt As String = ""
Dim iType As Byte = 0
KvittPrtType(iType, KvittPrt)
' iType should now have the value 1 - BUT IS STILL 0!?!?!?!?!?
' KvittPrt should now have the value "Common" - but is still
"".?!?!?!?!
....
End Sub

Public Sub KvittPrtType(ByVal iType As Byte, ByVal KvittPrt As String)
iType = 1
KvittPrt = "Common"
End Sub
End Module

Why is my subroutine KvittPrtType not returning any values?????

Kjell Weding
Norway

Aug 24 '07 #2

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

Similar topics

7
by: Dr John Stockton | last post by:
What are the best ways of returning multiple results from a subroutine ? I've been using ... return } which is inelegant. I'm used to Pascal's procedure X(const A, B : integer; var C, D :...
11
by: RichN | last post by:
I am developing a c program in Visual Studio .NET 2003. I also have an Intel(R) Fortran compiler for MVS .NET My fortran sourcecode already existed. I started a new fortran project and chose to...
3
by: IamIan | last post by:
I am using os.spawnv in Python 2.1 to do some geoprocessing in a subroutine/process. Everything works great, except when the processing is done the subroutine just waits for a couple minutes before...
5
by: MRW | last post by:
Hello! I'm running two subroutines one after another. The first subroutine works and does something to a several session variables (just an example), then those session variables are accessed...
1
by: peterv6 | last post by:
I'm using a "package" type subroutine, called test_package.pl. I'm calling it from a script called split0.pl. I want to pass the $0 variable, use the subroutine to split out just the filename, and...
4
by: otterbyte | last post by:
Hi, I have a bit of code which is confusing me to no end. Here are the basics: 1) The class module is being used in the module of a form. 2) There is an instance of the object declared at the...
1
by: jonniethecodeprince | last post by:
Howdy, I've been trying to do a basic calculation in PERL using a subroutine however i'm confused about a few thing. In the following code what is the signifcants of the list variable "@_" ...
1
by: pavanponnapalli | last post by:
hi , I have got a code as under : sub dbcall { my %hash; my $i=0; print "<<<<<<<@_>>>>>>> \n"; foreach(@_)
1
by: 2Penny | last post by:
Ladies, Gentlemen - It's been about 3 years since I translated 68000 assembly language code into 'C' and I remember that 'C' design model that I didn't like. 'C', as I understand it, was...
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:
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.