thomat65
unread,Nov 28, 2008, 1:23:01 PM11/28/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Thanks for the reply, and I appreciate the input.
However, I think I should apologize for not making my first post as
clear as it should have been. When all is said and done, I would like
to be able to code this:
"
enum states
x
o
othervalue1
othervalue2
end enum
public sub main()
dim enumVariable as states = x
dim str as String = enumVariable
msgbox(str)
end sub
"
and then call the main subroutine and have a message box pop up that
instead of saying the integer value of states.x (in this case "0"),
says "Value X" (or whatever).
I understand that i could do this:
"
public class statesConverted
public enum states
value1
value2
value3
value4
end enum
public value as states
public sub New()
value = states.value1
end sub
public shared widening operator CType(variable as statesConverted)
as String
select case variable.value
case states.value1
return "This is value 1"
case else
return "Other values"
end select
end operator
end class
public sub main()
dim newVariable as new statesConverted()
msgbox(newVariable) 'will work
msgbox(newVariable.value) 'still won't do what i want
end sub
"
and accomplish basically the same idea, but I run into the same
problems as before whenever I try to turn the enumerated type into a
string.
So now my revised question: does
vb.net have the capability to
overload operators for enumerated types without using a container
class to act as a sort of middle man?
Thanks again.