I would like to use the values declared in the Enum section and get the names of those variables.
The result I am getting is : "Not Chosen : 0".
But I want the result to be : "Not chosen English" and in the next loop "Not chosen Science".
Kindly suggest. Thanks.
Code:
Private Enum Bks
[_First] = 0
English = 0
Maths = 1
Science = 2
[_Last] = 2
End Enum
Dim MyBooks(2) As Boolean
Private Sub cmdEnumTrial_Click()
Dim ChosenBooks As String
Dim Runr As Integer
Dim UserBooks() As String
ChosenBooks = "English, Maths, Science"
UserBooks = Split(ChosenBooks, ",")
'User chooses the Option Button of MATHS.
'This value is received using the following IF Statement.
'The following statements are not disabled here, but are used in the main programme.
'If OptBtnEng.Value = True Then
'MyBooks(Bks.English) = True
'ElseIf OptBtnMath.Value = True Then
MyBooks(Bks.Maths) = True
'ElseIf OptBtnSc.Value = True Then
'MyBooks(Bks.Science) = True
'End If
For Runr = LBound(UserBooks) To UBound(UserBooks)
If MyBooks(Runr) = False Then 'checking which Book has been chosen
For ECtr = Bks.[_First] To Bks.[_Last]
If Runr = ECtr Then
'msgbox "You have not chosen :" & MyBooks(Runr) 'This code failed
'msgbox "You have not chosen :" & Bks.ECtr 'This code failed
'msgbox "You have not chosen :" & Bks & ".ECtr" 'This code failed
'Result of the following is : "Not Chosen : 0" or "Not Chosen : 2"
msgbox "You have not chosen :" & Bks.[_First] + Runr
'The result should be : "Not chosen English"
Exit For
End If 'Runr = ECtr
Next ECtr 'ECtr = Bks.[_First] To Bks.[_Last]
End If 'MyBooks(Runr) = false
Next Runr 'Runr = LBound(UserBooks) To UBound(UserBooks)
End Sub
But I want the result to be : "Not chosen English" and in the next loop "Not chosen Science".
Kindly suggest. Thanks.
Last edited: