Initializing Array of UDT’s

Initializing Array of UDT’s

Here’s some simple code in Test.bas:

Public Type MY_RECORD    Field1 as String    Field1 as StringEnd Typein frmTest.frmGeneral DeclarationsPrivate mArrayOfRecords() as MY_RECORDForm_Load    'this line of code BOMBS    If IsEmpty(mArrayOfRecords) then        'dimension it    End IfEnd 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.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several