Dynamic enums in vb6 -


is there way create enum @ runtime in vb6? need create enum of products, i'll data of products @ runtime , supposed vary.

no.

the whole point of enums provide type safety @ compile time. example, if function accepts enum value parameter, range of valid inputs well-defined based on members of enum type. doesn't have worry how handle invalid input because result in compiler error.

there's no way achieve kind of type safety @ run time, dynamically created enums don't make sense. @ rate, they're not feature supported language or runtime environment.

you'll have use unique identifier (like string or numeric value) in place of enum. if wanted, create array or collection class mapped ids unique key (e.g., name of product). add products array dynamically @ runtime, , retrieve id name.

note strategy, need validate inputs , handle errors manually.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -