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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Use an array of boolean values  then you can set all to be false  and YesNo[myVariable] = true
FaheemAhmadGulAuthor Commented:
Thank you for your comment. I am a beginner (not fully aware of how to declare and use arrays) and do not know how to implement the solution you have suggested. I would be grateful if you could provide a an  example of how to do this for the problem I have posted. Thanks
This is what I think Andy Ainscow means:
Sub SetBooleans(MyVariable As Integer)
    Dim YesNo(5) As Boolean
    Dim i As Integer
    For i = 1 To 5
        YesNo(i) = (MyVariable = i)
    Next i
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FaheemAhmadGulAuthor Commented:
Many thanks. I am splitting the points with more points for Graham as the solution posted by him was more complete and really helped me understand the concept.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.