Here we will see how to use the "0" Custom Format Specifier in LightSwitch Visual Studio 2012. "0" Custom Format Specifier The "0" Custom Format Specifier serves as a Zero-Placeholder Symbol. Let us suppose that a value being formatted has some digits in the position where the zero (0) appear in the string, that digit is copied as it is to the output string. Otherwise a zero appears in the output string. The position of the left side zero before the decimal point and the right side zero after the decimal point determines the range of the digit present in a string.
The following is the procedure for creating a sample use of the Zero-Placeholder on a Screen. Step 1 Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer. Right-click on "Data Sources" and choose "Add Table". The table appears in the table designer window. Insert the records in the following table. In the preceding table I have added a record named "Fees" and I have set its datatype to "double". Step 2 Now once again go to the Solution Explorer, right-click on Screens and choose "Add Screen". The Add New Screen dialog box appears. Select the "Editable Grid Screen" from the Screen Template, inside screen information, choose "Student" under screen data and provide some name to the Screen and click the "OK" button. The Screen Designer appears as shown below. Step 3 Press F5 to run the application. Provide the information and we will get the following output. Step 4 Stop debugging the application. Now go to the Format Pattern of Property window in the table designer. Enter "0000" as the specifier in the format pattern of the Property window. Once again press F5 to run the application. We will get the following output as shown below. Step 5 Stop debugging the application. Once again go to the Format Pattern of Property window in the table designer. This time enter "000" as the specifier in the format pattern of the Property window. Once again press F5 to run the application. This time we will get the following output as shown below. Step 6 Stop debugging the application. Once again go to the Format Pattern of Property window in the table designer. This time enter "00" as the specifier in the format pattern of the Property window. Once again press F5 to run the application. This time we will get the following output. Note: The "00" specifier causes the string value to be rounded to the nearest digit preceding the decimal. For example: formatting 37.5 with "00" would result in the value 38.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: