Saturday, April 9, 2011

Visual studio Lightswitch Step by Step – (Part 2)

Creating a data entry and search screen

This post will demonstrate the creation of a lightswitch application
  • Open Microsoft Visual Studio 2010.
  • Select File > New Project and select LightSwitch Application (C#) template from the Installed Templates list.

  • Change the application’s Name to OnlineOrderApp and click OK
  • You'll be now presented with a screen to either Create a New Table (if the app is being created with an all new database) or Attach to External Database if you need to use LightSwitch as a front-end to an existing database.
  • Click on Create a New Table option from the list.
  • Add fields to the table (Customer) as given below and save the project

  • Next we’ll create a new data entry screen for the table we created.
  • In the Solution explorer, right click Screens and then select Add screen.

  • Select New Data Screen and name the screen CreateNewCustomer. Select Customer as the screen data. This will create a new screen with the controls and labels for the Customer entity.

  • You can change the default settings for the properties as given below.

  • Save the project and run the application to add the customer details.
  • You can use the Create new customer screen to add new customer details.

  • Similarly you can add more screens to the applications, like a search screen for customers as given below.

  • Run the application to verify the functionality.

Next we’ll see how to add multiple data sources to the application and extend the application and add more functionality.

No comments: