Here we will see how to use format patterns for the Decimal datatype in LightSwitch Visual Studio 2012.
Here we will see how to use format patterns for the Decimal datatype in LightSwitch Visual Studio 2012.The format pattern for Decimals consists of the following three types of patterns:
The following is the procedure for creating a sample use of the Decimal Format Pattern 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.In the preceding table I have added a record named "Fees" and I have taken its datatype as "Decimal".Step 2Select the "Fees" record from the table and go to the Property window and provide "." (decimal) under the Format Pattern TextBox.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 3Press F5 to run the application. Provide the information. When we click on the "Save" button we get the following output where the decimal point disappears, as shown:Step 4Stop debugging the application. Once again go to the Format Pattern of Property window in the table designer. This time enter "+." (plus symbol along with decimal point) in the format pattern of the Property window. Once again press F5 to run the application. This time the result is that the number will be displayed with a positive symbol (+).Step 5Stop debugging the application. Once again go to the Format Pattern of Property window in the table designer. This time enter "-." (minus symbol along with decimal point) in the format pattern of the Property window.Once again press F5 to run the application. This time the result is that the number will be displayed with a negative symbol (-).
Printing in C# Made Easy