Using the Visual Basic format() function
The Format function converts a value to a text string and gives you control over the string's appearance. For example, youcan specify the number of decimal places for a numeric value, leading or trailing zeros, currency formats, and portions of the date. The syntax is:
SyntaxFormat(expression [,format [,firstdayofweek [,firstweekofyear]]])
Any valid expression
A valid named or user-defined format expression
Aconstant that specifies the first day of the week
A constant that specifies the first week of the year
The firstdayofweek argument has thesesettings:
Constant Value Description
vbUseSystem 0 Use NLS API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 WednesdayvbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday
The firstweekofyear argument has these settings:
Constant Value Description
vbUseSystem 0 Use NLS APIsetting.
vbFirstJan1 1 Start with week in which January 1 occurs (default).
vbFirstFourDays 2 Start with the first week that has at least four days in the year.vbFirstFullWeek 3 Start with the first full week of the year.
If you try to format a number without specifying format, Format provides functionality similar to theStr function, although it is internationally aware. However, positive numbers formatted as strings using Format don’t include a leading space reserved for the sign ofthe value; those converted using Str retain the leading space.
If you are formatting a non-localized numeric string, you should use a user-defined numeric format to [continua]

Leer Ensayo Completo

Cite este ensayo


(2012, 10). Using Visual Basic Format. Recuperado 10, 2012, de


"Using Visual Basic Format" 10 2012. 2012. 10 2012 <>.


"Using Visual Basic Format.", 10 2012. Web. 10 2012. <>.


"Using Visual Basic Format." 10, 2012. consultado el 10, 2012.