I am going through some old VB6 code and in many forms, I encounter declaration statements like -
PEC_NUM_ENT(1) As Byte
EC_MORE_RW_EXIST(0) As Byte
EC_CODE_IND(0) As Byte
EC_DATA(7) As PRXDetail
My question is, do these fields have default values? If so, what are the values? Thanks.
The default value of a reference type is null . It means that if a reference type is a static class member or an instance field and not assigned an initial value explicitly, it will be initialized automatically and assigned the value of null .
The default value of Boolean is False .
You add a default value to a table field or form control whenever you want Access to enter a value in a new record automatically. For example, you can have Access always add the current date to new orders. Typically, you add a default value to your table fields.
1 Answer. Entry Required – if set to yes then it will be necessary for the user to insert the value in the field which means that field cannot be left blank. Default Value – A default value can be set for a field if user don't provide any value while entering the values in the table.
Yes. Numerical and date types default to 0, strings to an empty string (i.e., ""), boolean to False, and variant to EMPTY.
From the VB6 documentation
When variables are initialized, a numeric variable is initialized to 0, a variable-length string is initialized to a zero-length string (""), and a fixed-length string is filled with zeros. Variant variables are initialized to Empty. Each element of a user-defined type variable is initialized as if it were a separate variable.
PRXDETAIL looks like it might be a user-defined type
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With