by Chrysovalantis Anastasiades (5 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 15th September 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Simple way to start learning the enum statement
API Declarations
'Declaration(inside a module)
Public seasonpoint As Season
Public Enum Season
Winter = 1
Spring = 2
Summer = 3
Autumn = 4
End Enum
Public Function findSeason(in1 As Season) As String
Dim b As String
Select Case in1
Case 1
b = "Winter"
Case 2
b = "Spring"
Case 3
b = "Summer"
Case 4
b = "Autumn"
Case Else
b = "Error"
End Select
findSeason = b
End Function
Private Sub Command1_Click()
seasonpoint = 2
Print findSeason(seasonpoint)
seasonpoint = Summer
Print findSeason(seasonpoint)
End Sub