July 2004 - Posts

QA: Using Enum.Parse to Convert a String to an Enumeration Value

Question:
I have a string that holds the name of a value from an enumeration. How do I “cast“ that to the actual enumeration type?

Answer:
You can use the Parse method of the Enum class to do this conversion for you. Some sample VB code is shown below.

Dim dr As DialogResult
dr = CType([Enum].Parse(GetType(DialogResult), "Cancel"), DialogResult)
MsgBox(dr.ToString)

Posted by windsor | 1 comment(s)
Filed under:

Visual Studio 2005 Beta 1

Visual Studio 2005 Beta 1 is finally here! If you're a MSDN Universal Subscriber you can download it right now.

But wait, I can already hear most of you saying "I'm not an MSDN Universal Subscriber, what am I going to do?". Well I've got the answer for you as well. Microsoft has also announced the release of the Visual Studio 2005 Express Beta Products which are cut down (but still very robust) tools available for anyone to download and use right now. The Beta versions of these products are FREE, the price for the production versions has not been announced but they will be very low cost.

The Visual Basic, Visual C#, Visual C++ and Visual J# 2005 Express Editions all enable you to create Windows Forms and console-based applications as well as class libraries.

Visual Web Developer 2005 Express Edition is focused exclusively on Web development with ASP.NET 2.0. Choose from Visual Basic, C#, or J# languages.

SQL Server 2005 Express Edition complements the other Express products by providing database support that is both powerful and easy to use.

To get your hands on all this geeky goodness head on over to http://lab.msdn.microsoft.com/express/

Posted by windsor | with no comments
Filed under: