Step 4: Run and Test the Application
Collapse the table of content
Expand the table of content

Step 4: Run and Test the Application

You have created your first LightSwitch application. In this lesson, you will run the application and enter some data in the contact list.

To run and test your application

  1. On the Debug menu, click Start Debugging.

    This command runs your program and displays the Contact List screen.

    TipTip

    You can also press F5 to run your application.

  2. In the Contact List screen, click the add (+…) button.

    The Add New Contact dialog box appears. You can see fields for entering a name, company, telephone number, and email address.

  3. In the Contact Name field, type Howard Snyder, and then press Tab.

  4. In the Contact Company field, type Great Lakes Food Market, and then press Tab.

  5. In the Contact Phone field, type 5035557555, and then press Tab two times.

    Notice how the telephone number is displayed with the correct formatting.

  6. In the Contact Email field, type howard@example, and then press Tab.

    The red outline that appears around the field indicates an error.

  7. Add .com to the end of the email address, and then press Tab.

    Notice that the red outline disappears, which indicates that the email address is correctly formatted.

  8. Click OK to close the dialog box, and then click the Save button on the Data ribbon to save your data.

  9. In the Search field, type 505, and then press Enter.

    The grid is empty because there is no matching contact that contains 505.

  10. In the Search field, change the entry to 503, and then press Enter.

    The grid now shows one matching contact, as shown in the following illustration:

    The running application
  11. Close the running application by clicking the Close button in the upper-right corner of the application window.

  12. On the File menu, click Save All.

    This saves your project so that you can use it in future lessons.

In this lesson you ran your program to see how it works. You might be surprised that you have a fully functioning application that implements data entry, navigation, validation, search and more, all without writing a single line of code. This is a basic strength of LightSwitch; all the necessary code is built in. This saves you work. If you had to do it all yourself, it would take hundreds or even thousands of lines of code.

Of course, the contact management application is much simpler than most applications that you will create. You will likely need screens that combine data from multiple sources, or that change the display based on certain conditions, and most applications will have multiple screens. You will learn about all those things and more in the remaining lessons.

LightSwitch reduces the need to write code for common scenarios, but there will also be cases where you have to write code. Every business has its own set of rules. For example, a certain class of customers might get a discount, or certain purchases might be exempt from taxes. As a business application developer, you understand the business rules and can express them in code.

Your first LightSwitch application is finished. In the following lessons, you will learn more about data entities and connecting to data.

Next lesson: Connecting to Data.

Show:
© 2016 Microsoft