Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

VbTypeName Function

Class

Microsoft.VisualBasic.Information

Syntax

VbTypeName (urtName)

urtName (required; String)

The name of a Common Type System data type

Description

The VbTypeName function returns the name of the Visual Basic data type wrapper that corresponds to a particular Common Type System (CTS) data type. For instance, passing "DateTime" returns the text "Date."

Usage at a Glance

  • If urtName is not a valid CTS data type or does not correspond to a Visual Basic data type, the function returns Nothing.

  • To determine the VB data type of a particular variable, call the variable's GetType method to retrieve a Type object and then call the Type object's ToString method to retrieve its data type name. This string can then be passed to the VbTypeName function. For example:

    vbName = VbTypeName(someVariable.GetType( ).ToString( ))

Version Differences

The VbTypeName function is new to VB under .NET.

See Also

SystemTypeName Function, TypeName Function

Категории