This article describes how to use Standard Numeric Format Strings in LightSwitch Visual Studio 2012.
This article describes how to use Standard Numeric Format Strings in LightSwitch Visual Studio 2012.Standard Numeric Format Strings are used to format various Numeric Types. A standard numeric format string must be present in the form "Axx", where "A" is a letter called the Format Specifier and "xx" is an integer called the precision specifier. The specific range of precision specifier is from 0 to 99 and also affects the number of digits in the result. The following is the procedure for creating a sample showing how to use Standard Numeric Format Strings on a Screen .Step 1Open 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.Here in the table I added a record named "TutionFees" and I used the datatype "Decimal" for it as shown below.Step 2Select the "TutionFees" record from the table and go to the Property window and provide "P" under the Format Pattern TextBox. The result is Number multiplied by 100 and displayed with a percent symbol.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 the 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 3Press F5 to run the application. Provide the information. Step 4Stop debugging the application.Once again, go to the Format Pattern of the Property window in the table designer. This time enter "F" in the format pattern of the Property window. Here "F" represents Fixed Point.Once again press F5 to run the application. This time we will get the following output.Step 5Stop debugging the application.Once again go to the Format Pattern of Property window in the table designer. This time enter "F4" in the format pattern of Property window. Here 4 represent 4 digits will be there after the decimal places. Once again press F5 in order to run the application. This time we will get the following output.Step 6Stop debugging the application.Once again go to the Format Pattern of Property window in the table designer. This time enter "E" in the format pattern of Property window. Here E represent Exponential Notation.Once again press F5 in order to run the application. This time we will get the following output.For other such Standard Numeric Format Strings follow Standard Numeric Format String
Printing in C# Made Easy