Information.VbTypeName Method (String)

 

Returns a String value containing the Visual Basic data type name of a variable.

Namespace:   Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static string VbTypeName(
	string UrtName
)

Parameters

UrtName
Type: System.String

Required. String variable containing a type name used by the common language runtime.

Return Value

Type: System.String

Returns a String value containing the Visual Basic data type name of a variable.

VbTypeName returns the Visual Basic type name corresponding to the common language runtime type name. For example, if UrtName contains "Int32" or "System.Int32", VbTypeName returns "Integer". If VbTypeName does not recognize the value of UrtName, it returns Nothing (not the string "Nothing").

The type name in UrtName can be obtained from various sources, for example from the Name property in the MemberInfo array of the Type class.

The following example uses the VbTypeName function to return data type names for several variables.

Dim sysDateName As String = "System.DateTime"
Dim sysShortName As String = "Int16"
Dim sysBadName As String = "Nonsense"
Dim testVbName As String
testVbName = VbTypeName(sysDateName)
' Returns "Date".
testVbName = VbTypeName(sysShortName)
' Returns "Short".
testVbName = VbTypeName(sysBadName)
' Returns Nothing.

.NET Framework
Available since 1.1
Return to top
Show: