Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TryParse is not a member of System.Enum error in VB.NET

I checked out http://msdn.microsoft.com/en-us/library/dd783499.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1. It should exist.

EDIT: I tried it on vs2010 (different project, though), and it exists.

like image 981
PenguinBlues Avatar asked Dec 31 '25 01:12

PenguinBlues


2 Answers

Enum.TryParse was added with .Net Framework 4.0.

You can easily tell this by looking at the Other Versions drop down menu in the documentation or the version Information:

.NET Framework
Supported in: 4.5, 4
.NET Framework Client Profile
Supported in: 4
Portable Class Library
Supported in: Portable Class Library
.NET for Windows Store apps
Supported in: Windows 8

So probably you're using an older .Net Framework version.

like image 99
sloth Avatar answered Jan 01 '26 15:01

sloth


Do you have System Import?

Imports System

If you are in Visual Studio 2010, make sure you are targeting .NET Framework 4.0

enter image description here

like image 32
Carlos Landeras Avatar answered Jan 01 '26 15:01

Carlos Landeras