Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why forced to use Function instead of Sub
Message
From
31/12/2004 20:25:45
 
 
To
31/12/2004 16:36:11
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
00973583
Message ID:
00973602
Views:
12
>But, why am I forced to use a function in order to return a value:

Because you can only use a function in VB.Net to return a value - that's just the way it is. However, this kind of distinction is not an issue in C#.

FWIW, even in VFP, despite the fact that you can return a value from a procedure, the general idea was that functions return values and procedures just execute code where a return value is not the issue. VB.Net actually does what it is supposed to do in this regard.

>Whenever I add a new function to a VB.NET code inside my form, I always end up with something like this:
>
>
>    Private Sub MyFunction()
>
>    End Sub
>
>
>But, why am I forced to use a function in order to return a value:
>
>
>    Private Function GetUrl(ByVal tcUrl As String) As String
>        Dim lcMergedText As String
>
>        Return lcMergedText
>    End Function
>
>
>This syntax confuses me. I just don't understand why we can't use the Sub approach when returning a value.
-=Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform