Home > Software engineering >  Vb type defines a single variable is why display. 984747 this form?
Vb type defines a single variable is why display. 984747 this form?

Time:09-20

CodePudding user response:


User-defined numeric Format (the Format function)


The following table identifies the number of characters can be used to create user-defined numeric format:

Character description
No display no numerical format,
Digital placeholders (0), according to a number or zero, if the expression in the format string 0 there are a number of position, then display; Otherwise, it displayed in a zero, if numerical digits is less than the format expression of zero digits (either left or right) side of the decimal point, then put up front or the back of the zero, if the decimal point to the right numerical digits than in decimal format expression right zero digits, then the last of the rounded to zero digits, if the value of the decimal point left digits than in decimal format expression left zero digits, so much a part of or unscripted display,
(#) digital placeholder, display a number or nothing, if the expression in the format string figures are the location of the "#", then display; Otherwise, the position is what all don't, according to
The working principle of the symbol and "0" digital placeholder is roughly same, the difference only in when expressions numerical digits is less than the "#" digits (decimal point to the left or right), won't put in front of or behind the zero displayed,

Decimal point (.) a placeholder, and in some country is when the decimal point with a comma, decimal placeholders used to determine the decimal point about how many digits can be shown, if the expression format only sign in the symbol on the left, then a number will begin with decimal point for less than 1, if want to have a "0" in front of the decimal Numbers, then please in front of the decimal point placeholder plus the number "0" placeholder, decimal placeholder actual characters in format depends on the output of the system of the digital format,
Percentage (%) sign a placeholder, expression multiplied by 100, the percentage of character (%) will be inserted into a position in the format string,
(,) micrometer a placeholder symbols, in some country, is to use a period to be one thousand symbols, one thousand symbols are mainly the numerical decimal point on the left more than one thousand, more than four digits separated if format in digital placeholders (0 or #) contains a micrometer around a symbol, is designated as the micrometer is a standard notation to use, two adjacent micrometer symbol or a micrometer level symbol immediately to the left of the decimal point (regardless of whether or not specified decimal places), its meaning is "the numerical divided by 1000, according to the need to round up", for example, you can use the format string "# # 0," will says 100 million to 100, the value is less than 1 million words as "0", the two adjacent micrometer symbols in addition to following the decimal point on the left, in the presence of any position are simply used as the specified micrometer symbols, decimal placeholder real characters in the output format will be subject to the digital format of system identification,
(:) time delimiter, in some country, may use other symbols to be delimiter, time when formatting time value, time separators can be used to separate, minutes and seconds, the time of the separator real characters in the output format depends on the system Settings,
Date (/) delimiter, in some country, may be when the date separator, with other symbols in the formatted date value, date separator can be used to separate year, month, day, date separator real characters in the output format, depending on the system Settings,
(E - E + E - E +) scientific format, if the format expression in E - E +, E - or right of the E + containing at least one digital placeholders (0 or #), then the numerical format will be represented as science, and E or E will be placed between the index and Numbers, the number of E or E to the right digital placeholder depends on index digits, using E - or E - with a minus sign to indicate a negative, have been using a + E and E +, will use a minus sign to indicate a negative have been represented by a plus sign is been found,
- + $() to display a literal characters, if want to display the list of characters of characters, you can use the backslash (\) character as a prefix or enclosed in double quotation marks (" "),
The next character (\) format string displayed, if you want to show character and has a special meaning as the original meaning of characters, the characters can be placed in a backslash (\), after the backslash itself will not be displayed, and use the backslash (\) and the effect of using double quotes is the same, if you want to display the backslash character, can use two backslashes (\ \),
Those who can't show for literal characters character is a date format characters and time format characters (a, c, d, h, m, n, p, q, s, t, w, y and/or:), the numerical format characters (#, 0, %, E, E, commas and periods) and string format character (@, & amp; , & lt; , & gt; And!) ,

(" ABC ") shows the double quotes (" ") within a string, such as in the code to contain a string in the format, must use CRH (34) the text enclosed (34 for double quotation marks (") character code),

CodePudding user response:

The Format (S, "0.000000")

CodePudding user response:

The format definition format

CodePudding user response:

Formatting data
DIM SJ As single
SJ=you need to display the data
Format (SJ, "0.00") shows the decimal after two
Format (SJ, "0.000000") shows the decimal after six
Format (SJ, # #, "0000000") with QianFenHao, and show the decimal after three

CodePudding user response:

This is not a problem "type", is "display format question!"
If you want to show the decimal fraction "leading 0", the best solution is to use formatting function;
Can also write their own a "format function" to adapt to the decimal digits uncertainty,
It is best not to rely on the setting of the control panel, because it can lead to different inconsistent results shown on a computer,

CodePudding user response:

truth, 1/f,

CodePudding user response:

refer to 6th floor zhao4zhong1 response:
truth, 1/f,

CodePudding user response:

refer to 7th floor Chen8013 response:
Quote: refer to the sixth floor zhao4zhong1 response:

truth, 1/f,


CodePudding user response:

You can be!

CodePudding user response:

1) use the Format function Format shows decimal,
Format, returns the Variant (String), which contains an expression, it is according to the Format to Format the instructions of expression,

 Private Sub Form_Click () 
The Debug. Print Format (4/10, "0.0000")
The Debug. Print Format (1/7, "0. # # # # # #")
End Sub

2) start menu - control panel - time, language and region - change the date, time or digital format - other Settings - zero initial display - 0.7,
Say this method may be 5 floor,
The above reply reference: https://zhidao.baidu.com/question/98010300
  • Related