Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual Basic
Functions
 Return Values for the CStr Function

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Basic Language Reference 
Return Values for the CStr Function 

The following table describes the return values for CStr for different data types of expression.

If expression type is CStr returns

Boolean Data Type (Visual Basic)

A string containing "True" or "False".

Date Data Type (Visual Basic)

A string containing a Date value (date and time) in the short date format of your system.

Numeric Data Types

A string representing the number.

The Date type always contains both date and time information. For purposes of type conversion, Visual Basic considers 1/1/0001 (January 1 of the year 1) to be a neutral value for the date, and 00:00:00 (midnight) to be a neutral value for the time. CStr does not include neutral values in the resulting string. For example, if you convert #January 1, 0001 9:30:00# to a string, the result is "9:30:00 AM"; the date information is suppressed. However, the date information is still present in the original Date value and can be recovered with functions such as DatePart Function (Visual Basic).

NoteNote

The CStr function performs its conversion based on the current culture settings for the application. To get the string representation of a number in a particular culture, use the number's ToString(IFormatProvider) method. For example, use System.Double.ToString(System.IFormatProvider) when converting a value of type Double to a String.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker