I am a newbie to C# and have come across some VB .NET code in my studies. I
notice that VB uses functions and subs, and was wondering what the difference
was. Is it that one has a return value and the other doesn't? 13 1788
"cashdeskmac" <ca*********@discussions.microsoft.com> schrieb I am a newbie to C# and have come across some VB .NET code in my studies. I notice that VB uses functions and subs, and was wondering what the difference was. Is it that one has a return value and the other doesn't?
Yes, it is.
Armin
well with byref parameters a sub can also return values ,,,,
maybe a better explanation if you can follow me , is that a sub is a
method that doesn`t return values by its method name , and a function is a
method that can return values by it`s method name
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uq**************@TK2MSFTNGP14.phx.gbl... "cashdeskmac" <ca*********@discussions.microsoft.com> schriebI am a newbie to C# and have come across some VB .NET code in my studies. I notice that VB uses functions and subs, and was wondering what the difference was. Is it that one has a return value and the other doesn't?
Yes, it is.
Armin
"m.posseth" <mi*****@nohausystems.nl> schrieb well with byref parameters a sub can also return values ,,,,
Yes, but not as the function value. That's what he meant (probably).
maybe a better explanation if you can follow me , is that a sub is a method that doesn`t return values by its method name , and a function is a method that can return values by it`s method name
"Armin Zingler" <az*******@freenet.de> wrote in message news:uq**************@TK2MSFTNGP14.phx.gbl... "cashdeskmac" <ca*********@discussions.microsoft.com> schriebI am a newbie to C# and have come across some VB .NET code in my studies. I notice that VB uses functions and subs, and was wondering what the difference was. Is it that one has a return value and the other doesn't?
Yes, it is.
Armin
"m.posseth" <mi*****@nohausystems.nl> schrieb: well with byref parameters a sub can also return values ,,,,
Even a 'ByVal' parameter of a reference type can do that ;-).
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Herfried, Even a 'ByVal' parameter of a reference type can do that ;-).
No it does not "return" a value, those can be set.
A sub is just a void function.
Cor
Michel.
I don't agree with you, a void function (in VBNet a Sub) does not "return" a
value. You can set values, however those are not returned.
You can use them afterwards, however that I see as a complete different
approach, as there are than more possibilities. (By instance set values in
modules or whatever)
Just my thought,
Cor
"Cor Ligthert" <no************@planet.nl> schrieb: Even a 'ByVal' parameter of a reference type can do that ;-). No it does not "return" a value, those can be set.
It depends on how you define "returing a value".
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
> It depends on how you define "returing a value".
Maybe in Thuringen however for the rest of the world it is well knowed.
A = B where B returns a value to A.
Cor
Cor,
"Cor Ligthert" <no************@planet.nl> schrieb: It depends on how you define "returing a value".
Maybe in Thuringen however for the rest of the world it is well knowed.
A = B where B returns a value to A.
I still believe that using output parameters is one technique to "return"
values.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb Cor,
"Cor Ligthert" <no************@planet.nl> schrieb: It depends on how you define "returing a value".
Maybe in Thuringen however for the rest of the world it is well knowed. A = B where B returns a value to A.
I still believe that using output parameters is one technique to "return" values.
Yes, but talking about the difference between subs and functions, the
statement "Is it that one has a return value and the other doesn't?" it's
for sure related to the function return value. I think you know this. :-)
Armin
"Armin Zingler" <az*******@freenet.de> schrieb: It depends on how you define "returing a value".
Maybe in Thuringen however for the rest of the world it is well knowed. A = B where B returns a value to A.
I still believe that using output parameters is one technique to "return" values.
Yes, but talking about the difference between subs and functions, the statement "Is it that one has a return value and the other doesn't?" it's for sure related to the function return value. I think you know this. :-)
Yeah, I know this :-).
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl... "Armin Zingler" <az*******@freenet.de> schrieb: I still believe that using output parameters is one technique to "return" values.
This is also referred to as "side-effect" programming. There are times when
it's necessary, but as a general rule, it is harder to maintain code that
returns values in parameters. The most common usage for this is in a
function that returns a status code and puts a value (usually a string or
byte array) in a passed parameter. The windows API is full of these.
Mike Ober.
"Michael D. Ober" <mdo.@.wakeassoc..com> escribió en el mensaje
news:ei****************@TK2MSFTNGP14.phx.gbl... This is also referred to as "side-effect" programming. There are times when it's necessary, but as a general rule, it is harder to maintain code that returns values in parameters.
Java? ;-)
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers: http://www.mztools.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brandon J. Van Every |
last post by:
What's better about Ruby than Python? I'm sure there's something. What is
it?
This is not a troll. I'm language shopping and I want people's answers. I
don't know beans about Ruby or have...
|
by: Brandon J. Van Every |
last post by:
I'm realizing I didn't frame my question well.
What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump
up in your chair and scream "Wow! Ruby has *that*? That is SO...
|
by: Roy Yao |
last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ?
According to my analysis, operator sizeof, (type) and * have the same
precedence, and they combine from right to left. Then this...
|
by: Sarah Tanembaum |
last post by:
Beside its an opensource and supported by community, what's the fundamental
differences between PostgreSQL and those high-price commercial database (and
some are bloated such as Oracle) from...
|
by: Johnny |
last post by:
Hi,
I wonder what is the difference between the built-in function
getattr() and the normal call of a function of a class. Here is the
details:
getattr( object, name)
Return the value of...
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode...
|
by: z. f. |
last post by:
what's the difference between using the VB.NET function IIF or the c#
operator ?
VB.NET: a = iif ( b=c, d, e)
C#: a= (b==c)?d:e
TIA, z.
|
by: Daz |
last post by:
Hi everyone.
My query is very straight forward (I think).
What's the difference between
someFunc.blah = function(){ ; }
and
|
by: JonathanOrlev |
last post by:
Hello everyone,
I have a newbe question:
In Access (2003) VBA, what is the difference between a Module and a
Class Module in the VBA development environment?
If I remember correctly, new...
|
by: dolphin |
last post by:
What is the different between c++ call convention and c call
convention?Can some give some examples?
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
| |