S
shapper
Hello,
How do I convert a string an enumeration value?
I have the following Enum:
Public Enum MyEnum
Book = 1
Movie
End Enum
Basically, I have a variable of type MyEnum and I want to define a
value to it:
Dim MyString As String = "Book"
Dim MyVar As MyEnum = MyString
I am getting an error.
I then tried:
Dim MyVar As MyEnum = CType(MyString, MyEnum)
This is still not working.
Any idea of how to solve this?
Thanks,
Miguel
How do I convert a string an enumeration value?
I have the following Enum:
Public Enum MyEnum
Book = 1
Movie
End Enum
Basically, I have a variable of type MyEnum and I want to define a
value to it:
Dim MyString As String = "Book"
Dim MyVar As MyEnum = MyString
I am getting an error.
I then tried:
Dim MyVar As MyEnum = CType(MyString, MyEnum)
This is still not working.
Any idea of how to solve this?
Thanks,
Miguel