''' <summary>
''' Function to return the integer value of an enumeration
''' </summary>
''' <param name="_enum">Enum to work with</param>
''' <param name="val">The value we're looking for</param>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function GetIntValue(ByVal _enum As Type, ByVal val As Integer) As String
Dim idx As Integer = 0
'get the values from the enumeration
Dim values() As Integer = System.Enum.GetValues(_enu
'Now we loop through all the names in the enum list
'looking for a match
For i As Integer = 0 To values.Length - 1
'If this current index matches the name
'then we return that name
If values(i) = val Then
idx = values(i)
Exit For
End If
Next
Return idx
End Function
Main Topics
Browse All Topics





by: jaime_olivaresPosted on 2009-09-21 at 11:29:02ID: 25385914
However, I have absolutely NO idea how I can pass an enumeration into my function. I have tried the following with no luck:
Function GetScore(ByVal inputComboBox As ComboBox, ByVal inputEnumeration As String) As Int16
You should have some declaration for your enumerations, i.e. EnumTitle
this way you can declare your function to receive this type, like:
Function GetScore(ByVal inputComboBox As ComboBox, ByVal inputEnumeration As EnumTitle) As Int16