Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Mar 16, 2000



Application Security Testing: An Integral Part of DevOps

Initializing Array of UDT's

Here's some simple code in Test.bas:
Public Type MY_RECORD
    Field1 as String
    Field1 as String
End Type

in frmTest.frm
General Declarations
Private mArrayOfRecords() as MY_RECORD

    'this line of code BOMBS
    If IsEmpty(mArrayOfRecords) then
        'dimension it
    End If
End Sub
OK, Why can't I check if an array of user defined types has been initialized? IsEmpty does not work, nor does TypeName, VarType or any other type checking function. I get errors when I attempt to check the state of an un-initialized array of UDT's. Any explanations?

Typically, UDT members are initialized the same way that regular variables of the same type are (i.e., strings are empty strings, numbers are zero, etc.).

The best way to check your UDT is to either check the individual members or to add an extra member that can hold a true/false value to indicate if the UDT has been initialized.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date