Microsoft KB Archive/31911

= How to Nest User-Defined TYPE Declarations in Compiled Basic =

Article ID: 31911

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic for MS-DOS
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q31911



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.



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 = &quot;test&quot; PRINT k.n.x PRINT t(1).n.y

Additional query words: VBmsdos QuickBas BasicCom

Keywords: KB31911

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.