Controls like text labels, gauges, and level indicators that can display text or numbers have a Format String property that allows you to format the text. This is particularly useful for numbers.
Standard numeric values use Windows Standard Numeric Format Strings.
Examples:
| Input Value | Format String | Displayed |
|---|---|---|
0.1234
|
E2
|
1.23E-001
|
0.1234
|
P2
|
12.34%
|
The following formats are supported:
| Numeric type | Format string |
|---|---|
| Decimal | D or d |
| Exponential | E or e |
| Fixed | F or f point |
| General | G or g |
| Number | N or n |
| Percent | P or p |
| Round-trip | R or r |
| Hexadecimal | X or x |
| All digits |
@
|
![]() | |
Applying format strings may cause precision to be lost if there is a
long string of digits in the number. To preserve the entire string of
digits, set the format string to |
Custom numeric values use Windows Custom Numeric Format Strings, which typically consist of one or
more instances of the custom numeric specifiers 0 and
#. Two- and three-part custom numeric format strings are
also valid, using semi-colons to delimit the parts.
Examples:
| Input Value | Format String | Displayed |
|---|---|---|
5678
|
#,##0.00
|
5,678.00
|
5678
|
My 0 data points.
|
My 5678 data points.
|
123.456
|
#.#;(####)
|
123.5
|
-123.456
|
#.#;(####)
|
(123)
|
0
|
#.#;(####);zero
|
zero
|
You can build composite strings by using the {0}
placeholder to insert a text value.
Examples:
| Input Value | Format String | Displayed |
|---|---|---|
OFF
|
The alarm is {0}
|
The alarm is OFF
|
High
|
Tank level: {0}
|
Tank level: High
|
Both standard and custom date format strings are supported, using Windows Standard or Custom Date and Time Format Strings, respectively.
Examples:
| Input Value | Format String | Displayed |
|---|---|---|
May 9, 2016, 3:58 PM
|
d
|
05/09/2016
|
May 9, 2016, 3:58 PM
|
f
|
Tuesday, 09 May, 2016 15:58
|
07/14/2016 08:15:25
|
yyyy-MM-dd hh:mm tt
|
2016-07-14 08:15 AM
|