I have some code bellow

enum Part ( center,north,south);
......

how can i to prevent from an user to enter a data out of range of this enum group.
I mean if he/she type 3 or 4
Thanks Sergey

Validation is key

if you are doing it in code, make the method accept an enum value

if you can do that, agree with lizr and validate what is passed in, might want to add an enum value of unknown to your list and use it if an enum isn't valid for the specified int

if you are doing it in code, make the method accept an enum value

if you can do that, agree with lizr and validate what is passed in, might want to add an enum value of unknown to your list and use it if an enum isn't valid for the specified int

Thanks I will try it.
Sergey

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.