daghoff
asked on
How to define a new variabel type in VB.NET
Let me explain with an example.
By variabel type I mean f. ex. Boolean, String, Integer etc....
A variabel defined as Boolean can only hold the values True or False. Asigning anything else to it would result in a runtime error and/or a syntax error.
I would like to define a variabel type that we could call BolleanExt. A variabel defined as BooleanExt can only hold the values True, False or None. Asigning any other value will result in an error.
Another example could be a variable type that can only hold the three values Abc, Def or Ghi.
Can someone give me an exaple code on how this new variabel type could be defined so I can declare variabels from it in my code the same way I declare any other ordinary variabel like: Dim var1 As String.
By variabel type I mean f. ex. Boolean, String, Integer etc....
A variabel defined as Boolean can only hold the values True or False. Asigning anything else to it would result in a runtime error and/or a syntax error.
I would like to define a variabel type that we could call BolleanExt. A variabel defined as BooleanExt can only hold the values True, False or None. Asigning any other value will result in an error.
Another example could be a variable type that can only hold the three values Abc, Def or Ghi.
Can someone give me an exaple code on how this new variabel type could be defined so I can declare variabels from it in my code the same way I declare any other ordinary variabel like: Dim var1 As String.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> but I would like to see how it is being done in a class.
Not sure what you mean there. Using Enum within a class?
Not sure what you mean there. Using Enum within a class?
ASKER
Sorry for not expressing myself in a clear way. Enum or not Enum is not relevant.
My question is how to define a new variabel type within a class in the simplest way using whatever that is needed.
I have no ide how this is to be done. This is a black box for me that I try to get inside.
My question is how to define a new variabel type within a class in the simplest way using whatever that is needed.
I have no ide how this is to be done. This is a black box for me that I try to get inside.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Please give me a good example code or a link to something that explains this in a simple way.