This Question is Answered 

    What Are User-defined Types In VB And How They Are Implemented?

    Define it precisely.

    asked 2 years ago

    Date | Rating

    2 Answers


    The primitive data types (like integer, string, long etc.) can represent only a single or multiple variables of same data type, but sometimes we are needed to represent some real world objects (e.g. records) that is not possible by these simple data types.

    Thus, like many other programming languages, in VB there is a flexibility to define user-defined data types. These user-defined types are derived types because these are collection of variables of different primitive types.These types are also sometimes referred to as aggregates under the one name. We can define the user-defined type as:

    Private Type myRecord
    Num as integer
    Sum as long
    Balance as currency
    End Type

    Where 'Type' is a keyword and 'myRecord' is name of this user-defined type.
    Between the first statement and last statement of the above type definition, we can declare as many variables of any primitive type as we needed.
    The myRecord is user-defined type that consists of three variables as shown above.
    We can declare the variables of this type simply as:
    Dim record1 as myRecord
    where 'record1' is a variable of the type 'myRecord' and it consists of all the variables defined in myRecord definition.
    We can access and manipulate all the primitive type variables that are now a part of 'record1' by the following syntax:
    record1.Num=0
    record1.Sum=0
    record1.Balance=0$

    answered 2 years ago   

    New Comment

    500 characters left


      The primitive data types (like integer, string, long etc.)Can represent only a single or multiple variables of same data type, but sometimes we are needed to represent some real world objects (e.g. records) that is not possible by these simple data types. Thus, like many other programming languages, in VB there is a flexibility to define user-defined data types. These user-defined types are derived types because these are collection of variables of different primitive types.

      These types are also sometimes referred to as aggregates under the one name. We can define the user-defined type as:

      Private Type myRecord
      Num as integer
      Sum as long
      Balance as currency
      End Type

      where 'Type' is a keyword and 'myRecord' is name of this user-defined type.
      Between the first statement and last statement of the above type definition, we can declare as many variables of any primitive type as we needed.
      The myRecord is user-defined type that consists of three variables as shown above.
      We can declare the variables of this type simply as:
      Dim record1 as myRecord
      where 'record1' is a variable of the type 'myRecord' and it consists of all the variables defined in myRecord definition.
      We can access and manipulate all the primitive type variables that are now a part of 'record1' by the following syntax:
      record1.Num=0
      record1.Sum=0
      record1.Balance=0

      answered 2 years ago   

      New Comment

      500 characters left

      What is Blurtit ?

      Ask questions on any topic, get great answers from real people for FREE. Blurtit has hundreds of thousand of members so your sure to get the answer your looking for.

      Ask a Question.

        Ask a Question