Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why forced to use Function instead of Sub
Message
De
31/12/2004 20:25:45
 
 
À
31/12/2004 16:36:11
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00973583
Message ID:
00973602
Vues:
11
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform