This is so cool, so very, very cool! 
Author Message
 This is so cool, so very, very cool!

Discovered this by accident but it is so cool. Try this.

private enum ABC
   A=1
   BVALUE=2
   CNUMBER=45
end enum

msgbox(ABC.A) ' This displays 1.
msgbox(ABC.BVALUE.ToString) ' This displays BVALUE.

That is, ToString on enum members displays the name of the enum not the
value in string format. I was using bit masks to check the validity of
selected data and I used to print the binary value, like 3. Now with
ToString I can print "A" and "BVALUE" which is more suggestive of the
problem and is easier to 'read' than 3. The more I do things in VB.Net the
more and more I get to love this language. Under the hood are some really
nice features.

Just wanted to share this!

Peter.



Wed, 08 Jun 2005 06:33:19 GMT  
 This is so cool, so very, very cool!
Yes, that IS cool.  Handy for debuging.  Thanks for sharing.

Jordan



Quote:
> Discovered this by accident but it is so cool. Try this.

> private enum ABC
>    A=1
>    BVALUE=2
>    CNUMBER=45
> end enum

> msgbox(ABC.A) ' This displays 1.
> msgbox(ABC.BVALUE.ToString) ' This displays BVALUE.

> That is, ToString on enum members displays the name of the enum not the
> value in string format. I was using bit masks to check the validity of
> selected data and I used to print the binary value, like 3. Now with
> ToString I can print "A" and "BVALUE" which is more suggestive of the
> problem and is easier to 'read' than 3. The more I do things in VB.Net the
> more and more I get to love this language. Under the hood are some really
> nice features.

> Just wanted to share this!

> Peter.



Wed, 08 Jun 2005 16:32:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. A cool site and a cool group

2. Very cool in vbscript, Not so Cool in VB

3. I am working on cool project, looking for creative idea to help

4. Cool Installer

5. 12V portable electronic Cooler/warmers

6. COOL WIZARDS FOR MS ACCESS!!!

7. Announce - New Spam Free Discussion List - Find Cool sites and Review

8. A very cool software about project.

9. Cool Macros Needed for New Book!!

 

 
Powered by phpBB® Forum Software