Ok I am at a loss here and have check the docs and can’t find a way to do what I need. I have currently (on paper), arrays of string. These arrays are static and won’t change. I would like to preload them while coding (not real time) so I can reference the arrays when the app runs. Preloading the arrays make it easier for the coder (me). I looked at enumerations but I can’t do something like if enumCodes.indexof( stringCode ) < 0 then msgbox "ERROR" or something like that. or if not enumCodes.hasName( stringCode ) then msgbox "ERROR" . I can do the indexOf on an array but I can’t seem to find a way to have the array pre-built when the app is built.
I have lost my mind trying to figure this one out. it is probably very very simple answer.
I often wish that assigning a value not in the enumeration list of values would raise an exception
ie/
[code]enum Foo
bar
baz
end enum
dim f as Foo
f = Foo( 23 ) // <<<<<<<<< really wish this would raise an exception[/code]
and then an enum would work well for you
But there’s no way to define & assign an array property on a class / module / etc as part of defining it (ie no default value that is an array)
The closest I can think of is stuff it in a module, make it a have a static, and on the first access set the array up & then return a reference to that array
[code]module
function myFoo() as String()
static mArray() as string
if mArray.ubound < 0 then
mArray.append
.... etc
end if
return mArray
end function
end module[/code]
that way you set it up once & reuse the heck out of it