How to Nest User-Defined TYPE Declarations in Compiled Basic

ID: Q31911


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
  • Microsoft QuickBASIC for MS-DOS, versions 4.0, 4.0b, 4.5
  • Microsoft BASIC Compiler for MS-DOS and MS OS/2, versions 6.0, 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, version 7.0


SUMMARY

The following is an example of how to nest user-defined type declarations. An element inside a TYPE...END TYPE declaration can be declared with a user-defined type.


MORE INFORMATION

Code Example


' To try this example in VBDOS.EXE:
' 1. From the File menu, choose New Project.
' 2. Copy the code example to the Code window.
' 3. Press F5 to run the program.

' Declare one type as follows:
TYPE mytype
  x AS INTEGER
  y AS STRING * 5
END TYPE
' Declare an element of the following type with the above type (mytype):
TYPE txx
  n AS mytype
END TYPE

' Dimension variables with the nested type (txx):
DIM t(10) AS txx
DIM k AS txx
' Elements of the nested type variables can be used as follows:
k.n.x = 3
t(1).n.y = "test"
PRINT k.n.x
PRINT t(1).n.y 

Additional query words: VBmsdos QuickBas BasicCom

Keywords :
Version : MS-DOS:1.0,4.0,4.0b,4.5; :6.0,6.0b,7.0
Platform : MS-DOS
Issue type :


Last Reviewed: December 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.