Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET: Get class name of a instance

Is there a way to get the instance's class name with VB.NET?

like image 408
afe Avatar asked Aug 20 '10 18:08

afe


2 Answers

Dim type As Type = yourObject.GetType() Dim typeName As String = type.FullName 

Full name will get you the fully qualified name of the Type, including the namespace of the Type.

See MSDN for more information on what is available with Type.

like image 168
Kelsey Avatar answered Sep 26 '22 15:09

Kelsey


Try the following

Dim name = Me.GetType().Name

Or for any instance

Dim name = theObject.GetType().Name
like image 27
JaredPar Avatar answered Sep 26 '22 15:09

JaredPar