Data Screen in LightSwitch : Part 1


Visual Studio LightSwitch is a Microsoft's tool for building business applications. Visual Studio LightSwitch is a new member of the Visual Studio family. According to Microsoft, Visual Studio LightSwitch is "the simplest way to create business applications for the desktop or the cloud". Visual Studio LightSwitch is a Rapid Application Development (RAD) tool which is used to help write data-centric line of business (LOB) applications.

Data screen is an essential part of the LightSwitch. There are five types of data screens in the LightSwitch Application. Which are as follows:

  • New Data Screen
  • Search Data Screen
  • Details Screen
  • Editable Grid Screen
  • List and Details Screen

In this article we will discuss only the "New Data Screen".

New Data Screen

This screen is used when you may want to add new data to an empty table, or add data to an existing table.

How to use the new data screen

Step 1 : Open Visual Studio LightSwitch->Click on create new table.

image1.png

Step 2 : Create table like as person.

image2.png

Step 3 : Now we will add a new data screen. Right click on Screens->Add screen.

image3.png

Step 4 : Select new data screen->Select screen data (Person)->Ok.

image4.png

Step 5 : Run the application (press F5). Now you can create a new person. There are some built-in validations available in LightSwitch such as when you blank the first name column then an error will be issued i.e. "Value cannot be empty".

image5.png

Step 6 : If you have not entered the integer value in the age column then an error will be shown such as in the following image.

image6.png

Step 7 : If you entered less than 10 digits in the phone column then an error will be shown i.e. invalid phone number.

image7.png

Step 8 : If you entered email address without "@" sign then an error will be shown i.e. invalid email address.

image8.png

Step 9 : If you want to create a new person except with a different first person then you can do. For this purpose you will click on Create New Person like the below image.

image9.png

Step 10 : Now you can create the new person like as the below image.

image10.png

Step 11 : If you want to change the screen name then you can do that. For this purpose you will go to the design screen on the right corner of the application. Write the display name->Save.

image11.png

image12.png

Step 12 : If you want add delete button in your data screen then you can do. To add the delete button you will go to the design screen on the right corner of the application.

Go to command bar->Add->Delete->Save.

 image13.png

Step 13 : Now you will see there will present delete button in your data screen. Now you can delete the data using delete button.

image14.png

Summary

So here you saw how to use the new data screen in LightSwitch application. Data screens are an essential part of the Visual Studio LightSwitch. There are some built-in validation in a LightSwitch application if you to create custom validation in Lightswitch application then you can do that. To create custom validations in LightSwitch please open this link Custom Validation in Lightswitch

Some helpful resource


Similar Articles