SlideServe
Menu
Préférences
© SlideServe · v2026

Parameter Passing in Visual Basic

lynda avatar
6 diapositives · 324 Views · Sep 13, 2014

Parameter Passing in Visual Basic. Computer Science 2 Gerb Objective: Understand parameter passing in Visual Basic. Parameters. Recall that parameters are the data we pass to procedures to help them do their job When a procedure takes parameters , we declare them Give them a type

Parameter Passing in Visual Basic - slide 1
01 / 6Parameter Passing in Visual Basic
1 / 17

Télécharger la présentation

Parameter Passing in Visual Basic
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Parameter Passing in Visual Basic Computer Science 2 Gerb Objective: Understand parameter passing in Visual Basic

  2. Parameters • Recall that parameters are the data we pass to procedures to help them do their job • When a procedure takes parameters, we declare them • Give them a type • Give them a name • Decide whether they are ByVal or ByRef (more on this later) • The parameters that a procedure is declared to accept are called formal parameters • The values passed to it when it is called are called actual parameters • Parameters are also called arguments

  3. Formal Parameter Example: Three formal parameters Sub TwoDigits(ByVal intNum As Integer, ByRef intFirstDigit As Integer, ByRef intSecondDigits As Integer) intFirstDigit=intNum/10 intSecondDigit=intNum Mod 10 End Sub

  4. The first is an integer, ByVal Sub TwoDigits(ByValintNum As Integer, ByRef intFirstDigit As Integer, ByRef intSecondDigits As Integer) intFirstDigit=intNum/10 intSecondDigit=intNum Mod 10 End Sub

  5. Second and third are ByRef integers Sub TwoDigits(ByVal intNum As Integer, ByRef intFirstDigit As Integer, ByRef intSecondDigits As Integer) intFirstDigit=intNum/10 intSecondDigit=intNum Mod 10 End Sub

  6. Difference between ByVal and ByRef • If we called our twodigits procedure: Call TwoDigits(i,j,k) • The value of i will not change • i is declared ByVal, • This means its value will not change when the procedure is called • j and k could change after the procedure finishes • j and k are ByRef • That means if the procedure changes the value of these parameters, they remain changed after the procedure finishes