G
Gene Berger
(See <--????? below in Sub Load_Enum for problem).
I have looked and looked ... everyone speaks about
how to use enumerators (thanks) but WHAT TYPE is
it when passing as a parameter?
p_enm As System.Enum doesn't work.
p_enm As Object doesn't work.
p_enm As Type doesn't work.
Don't laugh please - I have tried stuff like:
Dim enm As System.Enum = CType(p_enm, System.Enum)
So what does work? (See <--????? below).
Public Enum enm_cboTest1 As Integer
Completed = 1
Not_Started = 2
End Enum
Public Enum cboTest2 As Integer
Completed = 1
Not_Started = 2
End Enum
Call Load_Enum(enm_cboTest1)
Call Load_Enum(cboTest2 As Integer)
Private Sub Load_Enum(ByVal p_enm As System.Enum) <--?????
Dim names As String() = System.Enum.GetNames(GetType(p_enm))
For i As Integer = 0 To names.Length - 1
Dim myText As String = names(i).Trim.Replace("_", " ")
Dim myValue As p_enm = System.Enum.Parse(GetType(p_enm), names(i))
Dim b1 As Integer = 0
Next
End Sub
I have looked and looked ... everyone speaks about
how to use enumerators (thanks) but WHAT TYPE is
it when passing as a parameter?
p_enm As System.Enum doesn't work.
p_enm As Object doesn't work.
p_enm As Type doesn't work.
Don't laugh please - I have tried stuff like:
Dim enm As System.Enum = CType(p_enm, System.Enum)
So what does work? (See <--????? below).
Public Enum enm_cboTest1 As Integer
Completed = 1
Not_Started = 2
End Enum
Public Enum cboTest2 As Integer
Completed = 1
Not_Started = 2
End Enum
Call Load_Enum(enm_cboTest1)
Call Load_Enum(cboTest2 As Integer)
Private Sub Load_Enum(ByVal p_enm As System.Enum) <--?????
Dim names As String() = System.Enum.GetNames(GetType(p_enm))
For i As Integer = 0 To names.Length - 1
Dim myText As String = names(i).Trim.Replace("_", " ")
Dim myValue As p_enm = System.Enum.Parse(GetType(p_enm), names(i))
Dim b1 As Integer = 0
Next
End Sub