·  VB - Syntax - Variables - Variant

 

- Info:

  - This tutorial shows how to create Variant and convert it to other Data Types.

  - Variant is variable that can change type during runtime it is not variable without a type.

  - If + operator is used on numerical string and number or numerical string, Visual Basic adds the two numbers.

  - If + operator is used on two character strings, Visual Basic concatenates the values.

  - This tutorial is based on http://zone.ni.com/devzone/cda/tut/p/id/2949.

 

- Procedure:

  - Create VB Application Test.vb

 

    Test.vb

    Sub Main()

    

      'CREATE.------------------------------------------------------------

      Dim value1                       'If As keyword is not used Variant is asumed.

      Dim value As Variant

          value = "123453"

    

      'DISPLAY.-----------------------------------------------------------

      MsgBox (value)

    

    End Sub