VbTypeName Function
Returns a String value containing the Visual Basic data type name of a variable.
Public Function VbTypeName(ByVal UrtName As String) As String
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.
Namespace: Microsoft.VisualBasic
Module: Information
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)