What are Enumerations in VB.NET and how are they used?
Enumerations are new in VB.Net (As apposed to VB(i)) and they are used to group related sets of constants. To create a Enumeration you use the Enum statement. Example using a EnumerationModule Module 1 Enum Months January=1 Feburary=2 March=3 April=4 May=5 June=6 July=7 August=8 September=9 October=10 November=11 December=12 End Enum Sub Main() System.Console.WriteLine(“December is “ & Months.December &” th Month”) End Sub End Module
When using constant's declared in an Enumeration, you need to refer to it like so:
Months.December.
The output of the above code displays December is the 12th Month.
Written by Sandeep Mogulla, Webmaster at www.startvbdotnet.com
Index
Sponsored links
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
Add complete SSH and SFTP support to your .NET framework application
ASP.NET 3.5 Hosting on Windows 2008!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
