·  VB – Syntax – Functions


- Info:

  - Function is like sub but it must return value which should be saved in variable with the same name as function name.


- Procedure:

  - Create VB Console Application Test.vb



    Sub Main()


      'NO PARAMETERS.---------------------------------------------------------

      Dim text As String

          text = NoParameters()

          text = NoParameters

          MsgBox (text)



      Dim value As Integer

          value = Parameters(10, 2)

          value = Parameters(10, _


          MsgBox (value)


    End Sub


    Function NoParameters() As String

      NoParameters = "Return value"

    End Function


    Function Parameters(p1 As Integer, p2) As String

      Parameters = p1 / p2

    End Function