Here we will see how to use a "#" Custom Format Specifier in LightSwitch Visual Studio 2012.The "#" custom format specifier is also known as a digit-placeholder symbol. Suppose the value to be formatted has a digit where the "#" symbol appears in the format string, that digit is copied to the output string. Otherwise, nothing is stored in that position in the output string as shown below in the example.Note: the "#" custom format specifier does not represent a zero, in other words it is not a significant digit, even if zero is the only digit that the string consists of. It will display zero in output only if it is a significant digit.The "##" format specifier results in the value being rounded to the nearest digit preceding the decimal. For example, formatting 44.5 with "##" would result in the value 45.Use the following procedure to create a sample use of 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 have added a record named "Fees" and I have taken its datatype as "Double" as shown.Step 2Select the "Fees" record from the table and go to the Property window and provide "#.##" under 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 the screen information, choose "Student" under the screen data and provide some name to the Screen and click the "OK" button.The Screen Designer appears as shown belowStep 3Press F5 to run the application. Provide the information.Now click on the "Save" button; we will get the following output. Step 4Now stop debugging the application. Once again go to the Format Pattern of Property window in the table designer. This time enter "###" in the format pattern of the Property window. Once again press F5 to run the application. This time we will get the following output.Click on the "Save" Button as shown below.
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: