Money Datatype in LightSwitch 2012

This article describes how to use the money data type in LightSwitch Visual Studio 2012.

The following is the procedure for how to use a money data type in LightSwitch.

Step 1

Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer.

Solution Explorer

Right-click on the Data Source and choose "Add Table".

Add Table

The table appears in the table designer window. Insert the records in the following table.

Person Table

Step 2

I have inserted a record named Salary in the table. For that I have used the Money data type. Click on the Salary field and go to the property window under the appearance section as shown below.

Select Salary Field

Select the Symbol Mode from the property window. A drop down list will appear.

Symbol mode

The list consists of three symbols:

1. No Currency Symbol

2. Currency Symbol

3. ISO Currency Symbol

Step 3

By default the currency symbol will be selected as shown in the figure below.

properties with Currency Symbol

In the Solution Explorer, right-click on the Screens and choose "Add Screen".

Add Screen

The Add New Screen dialog box appears. Select the "Editable Grid Screen" from the Screen Template, under screen information, choose "Person" under screen data and provide some name to the Screen and click the "OK" button.

Add New Screen

The screen designer will appear as shown below.

Screen Designer

Step 4

Press F5 to run the application. We get the Salary with a dollar symbol as shown.

salay with currency symbol

Step 5

Once again go to the property window and select the "No Currency Symbol" from the Symbol Mode
for the Salary field.

properties with no currency symbol

Now press F5 to run the application. This time
we get the Salary with no dollar symbol as shown.

salary with no currency symbol

Step 6

Now again
go to the property window and select the "ISO Currency Symbol" from the Symbol Mode for the Salary field.

properties with iso currency symbol

Now press F5 to run the application. This time
we get the Salary with ISO currency symbol as shown.

salary with iso currency symbol