This documentation is archived and is not being maintained.

Walkthrough: Creating a Simple Application 

Visual Studio 2005

This walkthrough demonstrates how to use Visual Studio 2005 to create a simple Smart Device Project, using either Visual C# or Visual Basic. The walkthrough also demonstrates how to run the application on your PC in the emulator, or on an actual device connected to your PC.


To install a finished application permanently on an actual device, you must first package it into a CAB file. For more information, see Walkthrough: Packaging a Smart Device Solution for Deployment.


Options available in dialog boxes and menu commands differ depending on your development settings. This Walkthrough was written using Visual Basic Development Settings and Visual C# Development Settings. To view or change your settings, choose Import and Export Settings on the Tools menu, click Reset IDE Settings, select the setting you want, and then click Reset Settings.

This walkthrough consists of four main tasks:

  • Choosing a target device.

  • Creating a device project.

  • Adding a button and event handler to the form.

  • Running the application on the target device.

You can perform this walkthrough targeting either an emulator or a physical device. You can even switch back and forth during the walkthrough. To ensure that you are prompted to select a device each time you deploy your solution, complete the following procedure.

To prompt for device choices at deployment time

  1. On the Tools menu, click Options, click Device Tools, and then click General. If Device Tools is not visible, select Show all settings at the bottom of the Options dialog box.

  2. Select the Show device choices before deploying a device project check box.

In this section, you build a simple Windows Forms application. The following procedures include creating a Windows Forms project, adding a control to the form, adding event handling for the control, and finally building and testing the application. The steps to create a C++ project are not given here. If you are developing in C++, create a basic Hello World application, build a release version, and skip to the section called "To build, test, and save the application."

To create a device project

  1. (Visual Basic) On the File menu in Visual Studio, click New Project.


    (Visual C#) On the File menu in Visual Studio, point to New, and then click Project.

  2. Under Project Types in the New Project dialog box, expand Visual Basic or Visual C#, expand Smart Device, and then click Pocket PC 2003.

    If the language you want is not displayed at first, expand Other Languages. This display is governed by your profile settings.

  3. Under Templates, click Device Application.

  4. In the Name box, type AppForDeployment.

  5. (Visual C# only) In the Location box, verify where you want to store your project files.

  6. Click OK.

    A representation of a Pocket PC device appears in the Windows Forms Designer.

To add a control to the form

  1. From the Toolbox, drag a Button control onto the form.

    If the Toolbox is not visible, click Toolbox on the View menu.

    If the Device Controls tab is not visible in the Toolbox, right-click the Toolbox and select Show All, or select Reset Toolbox.

  2. Right-click the Button control, and then click Properties.

  3. In the Properties window, type Say Hello, and press ENTER to set the Text property.

To add event handling for the Button control

  1. Double-click the button on the form.

    The Code Editor opens with the insertion point positioned in the event handler.

  2. Insert the following Visual Basic code:

    MessageBox.Show("Hello, World!")


    Insert the following C# code:

    MessageBox.Show("Hello, World!");

To build, test, and save the application

  1. On the Debug menu, click Start.

  2. In the Deploy dialog box, select Pocket PC 2003 SE Emulator, and then click Deploy.

    Progress messages appear in the Output window, on the Status bar, and on the emulator screen.

  3. When the application is running on the emulator, tap the Say Hello button to ensure that "Hello, World!" is displayed.

  4. On the emulator File menu, click Exit to close the emulator before proceeding to the next section of this walkthrough.

  5. In the Device Emulator dialog box, click No in response to the Save State Before Exiting prompt.

  6. On the Visual Studio File menu, click Save All.

    If the emulator has not shut down entirely, the prompt Do you want to stop debugging? is displayed. Click Yes.

  7. In the Save Project dialog box, save the AppForDeployment project to a location of your choice.