# A more succinct way of writing an If Then Structure

In Visual Basic Project I have an integer variable named myVariable which can have a value from 1 to 3 and I have five Boolean Variables named YesNo1, YesNo2, YesNo3, YesNo4, YesNo5. I have an If then Structure like the following:

If myVariable = 1 Then
YesNo01 = True
YesNo02 = False
YesNo03 = False
YesNo04 = False
YesNo05 = False

ElseIf myVariable = 2 Then
YesNo01 = False
YesNo02 = True
YesNo03 = False
YesNo04 = False
YesNo05 = False

ElseIf myVariable = 3 Then
YesNo01 = False
YesNo02 = False
YesNo03 = True
YesNo04 = False
YesNo05 = False

End If

As you will notice in this a YesNo Variable corresponding to the myVariable becomes True and all the remaining become false.
I wish to know if there is more efficient way of writing the above structure. In my actual project myVariable can have a value from 1 to 25 and there are some 25 YesNo kind of variables and therefore it would help me if could find a more succinct way of writing the above structure.

Thank you for your help in anticipation.
SOLUTION
AndyAinscow

membership
Create an account to see this answer
Signing up is free. No credit card required.