+ADwAIQ-DOCTYPE HTML PUBLIC +ACI--//W3C//DTD HTML 3.2 Final//EN+ACIAPg- +ADw-HTML xmlns:MSHelp+AD0AIg-http://msdn.microsoft.com/mshelp+ACI- DIR+AD0AIg-LTR+ACIAPgA8-head+AD4- +ADw-meta HTTP-EQUIV+AD0AIg-Content-Type+ACI- Content+AD0AIg-text/html+ADs- charset+AD0-Windows-1252+ACIAPg- +ADw-title+AD4-Type Conversion Functions+ADw-/title+AD4- +ADw-xml+AD4- +ADw-MSHelp:TOCTitle Title+AD0AIg-Type Conversion Functions+ACI-/+AD4- +ADw-MSHelp:RLTitle Title+AD0AIg-Type Conversion Functions+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-A+ACI- Term+AD0AIg-vaGrpTypeConversion+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Boolean data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Byte data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CBool function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CByte function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CChar function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CDate function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CDbl function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CDec function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Char data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CInt function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CLng function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-converting types+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CSng function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-CStr function+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Currency data type, conversion functions+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-data type conversion, functions for+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Date data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-date, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Decimal data type+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Double data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-double-precision numbers+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Integer data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-integers, type conversion functions+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Long data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-numbers, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-rounding numbers, type conversions+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Short data type+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-Single data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-single-precision numbers, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-string conversion, conversion functions+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-String data type, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-text, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-times, converting+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-K+ACI- Term+AD0AIg-type conversion, functions for+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-A+ACI- Term+AD0AIg-vaGrpTypeConversion+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CBool+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CByte+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CChar+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CDate+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CDbl+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CDec+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CInt+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CLng+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CObj+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CShort+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CSng+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CStr+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-CVErr+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.cbool+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.cbyte+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.CChar+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.CDate+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.cdbl+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.CDec+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.cint+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.clng+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.CObj+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.CShort+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.csng+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.cstr+ACI-/+AD4- +ADw-MSHelp:Keyword Index+AD0AIg-F+ACI- Term+AD0AIg-vb.CVErr+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-DevLang+ACI- Value+AD0AIg-VB+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-DevLangVers+ACI- Value+AD0AIg-kbLangVB+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-DocSet+ACI- Value+AD0AIg-Visual Basic+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-DocSet+ACI- Value+AD0AIg-Visual Studio+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-DocSet+ACI- Value+AD0AIg-VSM+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-Product+ACI- Value+AD0AIg-VB+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-ProductVers+ACI- Value+AD0AIg-kbVBp700+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-Product+ACI- Value+AD0AIg-VSA+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-ProductVers+ACI- Value+AD0AIg-kbVSA+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-Technology+ACI- Value+AD0AIg-ManagedCode+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-TechnologyVers+ACI- Value+AD0AIg-kbManagedCode+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-TopicType+ACI- Value+AD0AIg-kbOrient+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-TargetOS+ACI- Value+AD0AIg-Windows+ACI-/+AD4- +ADw-MSHelp:Attr Name+AD0AIg-Locale+ACI- Value+AD0AIg-kbEnglish+ACI-/+AD4- +ADw-/xml+AD4- +ADw-meta name+AD0AIg-rtfFileName+ACI- content+AD0AIg-vbaconversion.rtf+ACIAPg- +ADw-meta NAME+AD0AIg-save+ACI- CONTENT+AD0AIg-history+ACIAPg- +ADwAIQ---CSS+AF8-START--+AD4- +ADw-SCRIPT SRC+AD0AIg-ms-help:/../commoner/scripts/dtuelink.js+ACIAPgA8-/SCRIPT+AD4- +ADwAIQ---CSS+AF8-END--+AD4APA-meta NAME+AD0AIg-msdnID+ACI- CONTENT+AD0AIgBf-74266+ACIAPg- +ADw-/head+AD4- +ADw-body topmargin+AD0-0 id+AD0AIg-bodyID+ACI- class +AD0- +ACI-dtBODY+ACIAPgA8ACE---NONSCROLLING BANNER START--+AD4- +ADw-div id+AD0AIg-nsbanner+ACIAPg- +ADw-div id+AD0AIg-bannerrow1+ACIAPg- +ADw-TABLE CLASS+AD0AIg-bannerparthead+ACI- CELLSPACING+AD0-0+AD4- +ADw-TR ID+AD0AIg-hdr+ACIAPg- +ADw-TD CLASS+AD0AIg-runninghead+ACI- nowrap+AD4-Visual+ACY-nbsp+ADs-Basic+ACY-nbsp+ADs-Language+ACY-nbsp+ADs-Reference+ADw-/TD+AD4- +ADw-TD CLASS+AD0AIg-product+ACI- nowrap+AD4AJg-nbsp+ADsAPA-/TD+AD4- +ADw-/TR+AD4- +ADw-/TABLE+AD4- +ADw-/div+AD4- +ADw-div id+AD0AIg-TitleRow+ACIAPg- +ADw-H1 class+AD0AIg-dtH1+ACIAPgA8-A NAME+AD0AIg-vagrptypeconversion+ACIAPgA8-/A+AD4-Type Conversion Functions+ADw-/H1+AD4- +ADw-/div+AD4APA-/div+AD4- +ADwAIQ---NONSCROLLING BANNER END--+AD4- +ADw-DIV id+AD0AIg-nstext+ACI- valign+AD0AIg-bottom+ACIAPgA8ACE-----+AD4- +ADw-P+AD4-These functions are compiled inline, meaning the conversion code is part of the code that evaluates the expression. Execution is faster because there is no call to a procedure to accomplish the conversion. Each function coerces an expression to a specific data type.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-syntax+ACIAPgA8-B+AD4-CBool(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CByte(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CChar(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CDate(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CDbl(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CDec(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CInt(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CLng(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CObj(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CShort(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CSng(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4- +ADw-B+AD4-CStr(+ADw-/B+AD4APA-I+AD4-expression+ADw-/I+AD4APA-B+AD4-)+ADw-/B+AD4APA-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-Part+ADw-/H4+AD4- +ADw-DL+AD4- +ADw-DT+AD4APA-I+AD4-expression+ADw-/I+AD4APA-/DT+AD4- +ADw-DD+AD4-Required. Any +ADw-B+AD4-String+ADw-/B+AD4- expression or numeric expression.+ADw-/dd+AD4- +ADw-/DL+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-Return Types+ADw-/H4+AD4- +ADw-P+AD4-The function name determines the return type, as shown in the following table:+ADw-/P+AD4- +ADw-div class+AD0AIg-tablediv+ACIAPgA8-table cellspacing+AD0AIg-0+ACI- class+AD0AIg-dtTABLE+ACIAPg- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TH width+AD0-22+ACUAPg-Function name+ADw-/TH+AD4- +ADw-TH width+AD0-18+ACUAPg-Return type+ADw-/TH+AD4- +ADw-TH width+AD0-60+ACUAPg-Range for +ADw-I+AD4-expression+ADw-/I+AD4- argument+ADw-/TH+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CBool+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Boolean+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg-Any valid +ADw-B+AD4-String+ADw-/B+AD4- or numeric expression.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CByte+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Byte+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg-0 through 255+ADs- fractions are rounded.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CChar +ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Char+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg-Any valid +ADw-B+AD4-String+ADw-/B+AD4- expression+ADs- value can be 0 through 65535.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CDate+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Date+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg-Any valid representation of a date and time.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CDbl+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Double+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg--1.79769313486231E+308- through +ADw-BR+AD4- -4.94065645841247E-324 for negative values+ADs- +ADw-BR+AD4- 4.94065645841247E-324 through +ADw-BR+AD4- 1.79769313486231E+308- for positive values.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CDec+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Decimal+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. For numbers with 28 decimal places, the range is +ADw-BR+AD4- 7.9228162514264337593543950335. The smallest possible non-zero number is 0.0000000000000000000000000001.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CInt+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Integer+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg--2,147,483,648 through 2,147,483,647+ADs- fractions are rounded.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CLng+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Long+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPgA8-B+AD4--+ADw-/B+AD4-9,223,372,036,854,775,808 through 9,223,372,036,854,775,807+ADs- fractions are rounded.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CObj+ADw-/B+AD4- +ADw-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Object+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg-Any valid expression.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CShort+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Short+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg--32,768 through 32,767+ADs- fractions are rounded.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CSng+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-Single+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg--3.402823E through -1.401298E-45 for negative values+ADs- 1.401298E-45 through 3.402823E for positive values.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-TR VALIGN+AD0AIg-top+ACIAPg- +ADw-TD width+AD0-22+ACUAPgA8-B+AD4-CStr+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-18+ACUAPgA8-B+AD4-String+ADw-/B+AD4APA-/TD+AD4- +ADw-TD width+AD0-60+ACUAPg-Returns for +ADw-B+AD4-CStr+ADw-/B+AD4- depend on the +ADw-I+AD4-expression+ADw-/I+AD4- argument. See +ADw-A HREF+AD0AIg-defcstrreturnstable.htm+ACIAPg-Returns for CStr+ADw-/A+AD4-.+ADw-/TD+AD4- +ADw-/TR+AD4- +ADw-/table+AD4APA-/div+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-Remarks+ADw-/H4+AD4- +ADw-P+AD4-If the +ADw-I+AD4-expression+ADw-/I+AD4- passed to the function is outside the range of the data type to which it is being converted, an error occurs.+ADw-/P+AD4- +ADw-P+AD4-In general, you can use the data type conversion functions to force the result of some operation to a particular data type rather than the default data type. For example, use +ADw-B+AD4-CDec +ADw-/B+AD4-to force decimal arithmetic in cases where single-precision, double-precision, or integer arithmetic normally would occur.+ADw-/P+AD4- +ADw-P+AD4-When the fractional part is exactly 0.5, +ADw-B+AD4-CInt+ADw-/B+AD4- and +ADw-B+AD4-CLng+ADw-/B+AD4- always round it to the nearest even number. For example, 0.5 rounds to 0 and 1.5 rounds to 2. +ADw-B+AD4-CInt+ADw-/B+AD4- and +ADw-B+AD4-CLng +ADw-/B+AD4-differ from the +ADw-B+AD4-Fix+ADw-/B+AD4- and +ADw-B+AD4-Int+ADw-/B+AD4- functions, which truncate, rather than round, the fractional part of a number. Also, +ADw-B+AD4-Fix+ADw-/B+AD4- and +ADw-B+AD4-Int+ADw-/B+AD4- always return a value of the same type as is passed in.+ADw-/P+AD4- +ADw-P+AD4-Use the +ADw-B+AD4-IsDate+ADw-/B+AD4- function to determine if a value can be converted to a date and time. +ADw-B+AD4-CDate+ADw-/B+AD4- recognizes date literals and time literals as well as numbers that fall within the range of acceptable dates.+ADw-/P+AD4- +ADw-P+AD4APA-B+AD4-CDate+ADw-/B+AD4- recognizes date formats according to the locale setting of your system. You must provide the day, month, and year in the correct order for your locale, or the date may not be interpreted correctly. A long date format is not recognized if it contains a day-of-the-week string, such as +ACI-Wednesday+ACI-.+ADw-/P+AD4- +ADw-P+AD4-The +ADw-B+AD4-Date+ADw-/B+AD4- data type always contains both date and time information. For purposes of type conversion, Visual Basic+ACY-nbsp+ADs-.NET considers 1/1/1 (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. If you convert a +ADw-B+AD4-Date+ADw-/B+AD4- value to a string, +ADw-B+AD4-CStr+ADw-/B+AD4- does not include neutral values in the resulting string. For example, if you convert +ADw-code class+AD0AIg-ce+ACIAPgAj-January 1, 0001 9:30:00+ACMAPA-/code+AD4- to a string, the result is +ACI-9:30:00 AM+ACIAOw- the date information is suppressed. However, the date information is still present in the original +ADw-B+AD4-Date+ADw-/B+AD4- value and can be recovered with functions such as +ADw-B+AD4-DatePart+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-P+AD4-The +ADw-B+AD4-CType+ADw-/B+AD4- function takes a second argument, +ADw-I+AD4-typename+ADw-/I+AD4-, and coerces +ADw-I+AD4-expression+ADw-/I+AD4- to +ADw-I+AD4-typename+ADw-/I+AD4-, where +ADw-I+AD4-typename+ADw-/I+AD4- can be any data type, structure, class, or interface. For more information, see +ADw-A HREF+AD0AIg-vafctctype.htm+ACIAPg-CType Function+ADw-/A+AD4-.+ADw-/P+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CBool Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CBool+ADw-/B+AD4- function to convert expressions to +ADw-B+AD4-Boolean+ADw-/B+AD4- values. If an expression evaluates to a nonzero value, +ADw-B+AD4-CBool+ADw-/B+AD4- returns +ADw-B+AD4-True+ADw-/B+AD4AOw- otherwise, it returns +ADw-B+AD4-False+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim A, B, C As Integer Dim Check As Boolean A +AD0- 5 B +AD0- 5 Check +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CBool(+ADw-/b+AD4APA-/code+AD4-A +AD0- B+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' Check is set to True. ' ... C +AD0- 0 Check +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CBool(+ADw-/b+AD4APA-/code+AD4-C+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-) +ADw-/b+AD4APA-/code+AD4-' Check is set to False.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CByte Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CByte+ADw-/B+AD4- function to convert an expression to a +ADw-B+AD4-Byte+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDouble As Double Dim MyByte As Byte MyDouble +AD0- 125.5678 MyByte +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CByte(+ADw-/b+AD4APA-/code+AD4-MyDouble+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyByte is set to 126.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CChar Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CChar+ADw-/B+AD4- function to convert a the first character of a +ADw-B+AD4-String+ADw-/B+AD4- expression to a +ADw-B+AD4-Char+ADw-/B+AD4- type.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyString As String Dim MyChar As Char MyString +AD0- +ACI-BCD+ACI- ' CChar converts only first character of string. MyChar +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CChar(+ADw-/b+AD4APA-/code+AD4-MyString+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyChar is set to +ACI-B+ACI-.+ADw-/PRE+AD4- +ADw-P+AD4-The input argument to +ADw-B+AD4-CChar+ADw-/B+AD4- must be of data type +ADw-B+AD4-String+ADw-/B+AD4-. You cannot use +ADw-B+AD4-CChar+ADw-/B+AD4- to convert a number to a character, because +ADw-B+AD4-CChar+ADw-/B+AD4- cannot accept a numeric data type. This example obtains a number representing a code point (character code) and converts it to the corresponding character. It uses +ADw-B+AD4-InputBox+ADw-/B+AD4- to obtain the string of digits, +ADw-B+AD4-CInt+ADw-/B+AD4- to convert the string to type +ADw-B+AD4-Integer+ADw-/B+AD4-, and +ADw-B+AD4-ChrW+ADw-/B+AD4- to convert the number to type +ADw-B+AD4-Char+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDigits As String ' Input string of digits to be converted. Dim CodePoint As Integer ' Number to be represented as a character. Dim MyChar As Char MyDigits +AD0- InputBox(+ACI-Enter code point of character:+ACI-) CodePoint +AD0- CInt(MyDigits) ' Convert entire string to Integer. MyChar +AD0- ChrW(CodePoint) ' MyChar is set to Char value of code point.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CDate Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CDate+ADw-/B+AD4- function to convert strings to +ADw-B+AD4-Date+ADw-/B+AD4- values. In general, hard-coding dates and times as strings (as shown in this example) is not recommended. Use date literals and time literals, such as +ACM-Feb 12, 1969+ACM- and +ACM-4:45:23 PM+ACM-, instead.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDateString, MyTimeString As String Dim MyDate, MyTime As Date MyDateString +AD0- +ACI-February 12, 1969+ACI- MyTimeString +AD0- +ACI-4:35:47 PM+ACI- ' ... MyDate +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CDate(+ADw-/b+AD4APA-/code+AD4-MyDateString+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' Convert to Date data type. MyTime +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CDate(+ADw-/b+AD4APA-/code+AD4-MyTimeString+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-) +ADw-/b+AD4APA-/code+AD4- ' Convert to Date data type.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CDbl Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CDbl+ADw-/B+AD4- function to convert an expression to +ADw-B+AD4-Double+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDec As Decimal Dim MyDouble As Double MyDec +AD0- 234.456784D ' Literal type character D makes MyDec a Decimal. MyDouble +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CDbl(+ADw-/b+AD4APA-/code+AD4-MyDec +ACo- 8.2D +ACo- 0.01D+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' Convert result to a Double.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CDec Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CDec+ADw-/B+AD4- function to convert a numeric value to +ADw-B+AD4-Decimal+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDouble As Double Dim MyDecimal As Decimal MyDouble +AD0- 10000000.0587 MyDecimal +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CDec(+ADw-/b+AD4APA-/code+AD4-MyDouble+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' Convert to Decimal.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CInt Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CInt+ADw-/B+AD4- function to convert a value to +ADw-B+AD4-Integer+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDouble As Double Dim MyInt As Integer MyDouble +AD0- 2345.5678 MyInt +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CInt(+ADw-/b+AD4APA-/code+AD4-MyDouble+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyInt is set to 2346.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CLng Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CLng+ADw-/B+AD4- function to convert values to +ADw-B+AD4-Long+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDbl1, MyDbl2 As Double Dim MyLong1, MyLong2 As Long MyDbl1 +AD0- 25427.45 MyDbl2 +AD0- 25427.55 MyLong1 +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CLng(+ADw-/b+AD4APA-/code+AD4-MyDbl1+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyLong1 contains 25427. MyLong2 +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CLng(+ADw-/b+AD4APA-/code+AD4-MyDbl2+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyLong2 contains 25428.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CObj Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CObj+ADw-/B+AD4- function to convert a numeric value to +ADw-B+AD4-Object+ADw-/B+AD4-. The +ADw-B+AD4-Object+ADw-/B+AD4- variable itself contains only a four-byte pointer, which points to the +ADw-B+AD4-Double+ADw-/B+AD4- value assigned to it.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDouble As Double Dim MyObject As Object MyDouble +AD0- 2.7182818284 MyObject +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CObj(+ADw-/b+AD4APA-/code+AD4-MyDouble+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' Double value is pointed to by MyObject.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CShort Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CShort+ADw-/B+AD4- function to convert a numeric value to +ADw-B+AD4-Short+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyByte as Byte Dim MyShort as Short MyByte +AD0- 100 MyShort +AD0- +ADw-B+AD4-CShort(+ADw-/B+AD4-MyByte+ADw-B+AD4-)+ADw-/B+AD4- ' Convert to Short.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CSng Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CSng+ADw-/B+AD4- function to convert values to +ADw-B+AD4-Single+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDouble1, MyDouble2 As Double Dim MySingle1, MySingle2 As Single MyDouble1 +AD0- 75.3421105 MyDouble2 +AD0- 75.3421567 MySingle1 +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CSng(+ADw-/b+AD4APA-/code+AD4-MyDouble1+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MySingle1 is set to 75.34211. MySingle2 +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CSng(+ADw-/b+AD4APA-/code+AD4-MyDouble2+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MySingle2 is set to 75.34216.+ADw-/PRE+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-CStr Example+ADw-/H4+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CStr+ADw-/B+AD4- function to convert a numeric value to +ADw-B+AD4-String+ADw-/B+AD4-.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDouble As Double Dim MyString As String MyDouble +AD0- 437.324 MyString +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CStr(+ADw-/b+AD4APA-/code+AD4-MyDouble+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyString is set to +ACI-437.324+ACI-.+ADw-/PRE+AD4- +ADw-P+AD4-This example uses the +ADw-B+AD4-CStr+ADw-/B+AD4- function to convert +ADw-B+AD4-Date+ADw-/B+AD4- values to +ADw-B+AD4-String+ADw-/B+AD4- values.+ADw-/P+AD4- +ADw-PRE class+AD0AIg-code+ACIAPg-Dim MyDate As Date Dim MyString As String ' ... MyDate +AD0- +ACM-February 12, 1969 00:00:00+ACM- ' INVALID format. ' Date literals must be in the format +ACM-m/d/yyyy+ACM- or they are invalid. ' ... MyDate +AD0- +ACM-2/12/69 00:00:00+ACM- ' Time is midnight. ' The neutral time value of 00:00:00 is suppressed in the conversion. MyString +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CStr(+ADw-/b+AD4APA-/code+AD4-MyDate+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyString is set to +ACI-2/12/1969+ACI-. ' ... MyDate +AD0- +ACM-2/12/69 00:00:01+ACM- ' Time is one second past midnight. ' The time component becomes part of the converted value. MyString +AD0- +ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-CStr(+ADw-/b+AD4APA-/code+AD4-MyDate+ADw-code+AD4APA-b class+AD0AIg-cfe+ACIAPg-)+ADw-/b+AD4APA-/code+AD4- ' MyString is set to +ACI-2/12/1969 12:00:01 AM+ACI-.+ADw-/PRE+AD4- +ADw-P+AD4APA-B+AD4-CStr+ADw-/B+AD4- always renders a +ADw-B+AD4-Date+ADw-/B+AD4- value in the standard short format for the current locale, for example, +ACI-2/15/2003+ACI-.+ADw-/P+AD4- +ADw-H4 class+AD0AIg-dtH4+ACIAPg-See Also+ADw-/H4+AD4- +ADw-P+AD4APA-A HREF+AD0AIg-vaidxconversion.htm+ACIAPg-Conversion Functions+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctctype.htm+ACIAPg-CType Function+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctasc.htm+ACIAPg-Asc, AscW Functions+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctchr.htm+ACIAPg-Chr, ChrW Functions+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctformat.htm+ACIAPg-Format Function+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafcthex.htm+ACIAPg-Hex Function+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctoct.htm+ACIAPg-Oct Function+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctstr.htm+ACIAPg-Str Function+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctval.htm+ACIAPg-Val Function+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-vafctdatepart.htm+ACIAPg-DatePart Function+ADw-/A+AD4- +AHw- +ADw-A HREF+AD0AIg-defcstrreturnstable.htm+ACIAPg-Returns for CStr+ADw-/A+AD4- +AHw- +ADw-MSHelp:link keywords+AD0AIg-vaconTypeConversions+ACI- TABINDEX+AD0AIg-0+ACIAPg-Type Conversions+ADw-/MSHelp:link+AD4APA-/P+AD4- +ADwAIQ---Footer Start--+AD4- +ADw-DIV CLASS+AD0AIg-footer+ACIAPg- +ADw-br+AD4- +ADw-HR+AD4APAAh---Feedback Link--+AD4- +ADw-p+AD4APA-A HREF+AD0AIg-JavaScript:sendfeedback('+AF8-74266', 'VSDOCS+AEA-MICROSOFT.COM')+ACIAPg-Send feedback to Microsoft+ADw-/A+AD4APA-/p+AD4APAAh---Copyright--+AD4- +ADw-p+AD4APA-MSHelp:link keywords+AD0AIg-vxmscCopyright+ACI- TABINDEX+AD0AIg-0+ACIAPgAm-copy+ADs- 2001 Microsoft Corporation. All rights reserved.+ADw-/MSHelp:link+AD4APA-/p+AD4APA-/div+AD4- +ADwAIQ---Closes the footer div--+AD4- +ADw-/div+AD4- +ADwAIQ---closes the topic content div--+AD4- +ADwAIQ---FOOTER+AF8-END--+AD4- +ADw-/body+AD4- +ADw-/html+AD4-