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, you can specify the number of decimalplaces for a numeric value, leading or trailing zeros, currency formats, and portions of the date. The syntax is:
Syntax
Format(expression [,format [,firstdayofweek [,firstweekofyear]]])expression
Any valid expression
format
A valid named or user-defined format expression
firstdayofweek
A constant that specifies the first day of the week
firstweekofyear
A constant that specifies thefirst week of the year
The firstdayofweek argument has these settings:
Constant Value Description
vbUseSystem 0 Use NLS API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3Tuesday
vbWednesday 4 Wednesday
vbThursday 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 thefirst full week of the year.
Notes
If you try to format a number without specifying format, Format provides functionality similar to the Str function, although it is internationally aware. However,positive numbers formatted as strings using Format don’t include a leading space reserved for the sign of the value; those converted using Str retain the leading space.
If you are formatting anon-localized numeric string, you should use a user-defined numeric format to ensure that you get the look you want.
If the Calendar property setting is Gregorian and format specifies date formatting, thesupplied expression must be Gregorian. If the Visual Basic Calendar property setting is Hijri, the supplied expression must be Hijri.
If the calendar is Gregorian, the meaning of format expression... [continua]

Leer Ensayo Completo

Cite este ensayo

APA

(2012, 10). Using Visual Basic Format. BuenasTareas.com. Recuperado 10, 2012, de http://www.buenastareas.com/ensayos/Using-Visual-Basic-Format/5734130.html

MLA

"Using Visual Basic Format" BuenasTareas.com. 10 2012. 2012. 10 2012 <http://www.buenastareas.com/ensayos/Using-Visual-Basic-Format/5734130.html>.

MLA 7

"Using Visual Basic Format." BuenasTareas.com. BuenasTareas.com, 10 2012. Web. 10 2012. <http://www.buenastareas.com/ensayos/Using-Visual-Basic-Format/5734130.html>.

CHICAGO

"Using Visual Basic Format." BuenasTareas.com. 10, 2012. consultado el 10, 2012. http://www.buenastareas.com/ensayos/Using-Visual-Basic-Format/5734130.html.