Phone Number Format in LightSwitch 2012

Here we will see how to format a Phone Number in LightSwitch Visual Studio 2012.

The following is the procedure for formating a Phone Number .

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 PhoneNo in the table. Click on the PhoneNo record and go to the property window under the appearance section as shown below.

properties of Phone No Field

Click on the "Phone Number Format" link. A "Phone Number Formats" dialog box will appear. From that you can choose a valid formats and the order that you can apply for various Phone Numbers.

phone No Format

Step 3

There is an empty TextBox provided in which you can enter the Phone Number to test whether it matches any of the following formats.

For example, I provided a 10-digit Phone Number, it matches the Format Number 6 as shown in the figure.

ten digit Phone No format

Suppose I have provided an 11-digit Phone Number, it matches the Format Number 3.

Eleven digit Phone No format

Similarly when I have a 6-digit Phone Number, it does not match any of the formats as shown below.

six digit phone no format

Now to allow a 6-digit Phone Number, we can add a new format.

New Format Added

Step 4

We can also change the order of the specific format by moving the format up or down using two arrows.

Move Up and Move Down

arrows

We can also delete the specific format of a Phone Number using the delete button.

delete

The Restore Default Format Setting button is used to set the default format of the Phone Number.

Restore default setting


Similar Articles