.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Collections >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Enum and Display Enum Valie using VB.net

Posted By:Narayanan       Posted Date: May 07, 2013    Points: 40    Category: Collections    URL: http://www.dotnetspark.com  

Here , I will explain Enum and display enum using VB.net
 

How to create Enum?
     An Enum type stores special values. These are named constants. With an Enum type we can remove magic constants throughout our program. And this improves code clarity.
Create Enum in VB.Net Program
Syntax for Enum
<access Modifier> Enum  <Enum_name>
value1
value2
End Enum


E.g:
 Public Enum Animals
        DOG
        TIGER
        LION
    End Enum


Call Enum Value in Form:
     MessageBox.Show(Animals.LION.ToString())


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend