Lesson 1: Creating a Visual Studio project

The following procedure creates and configures a new Visual Studio application. You can choose whether to use Visual Basic or C# as your programming language.

This tutorial assumes that if you are designing a C# application, your files are in the directory C:\tutorial\uldotnet\CSApp and that if you are designing a Visual Basic application, your files are in the directory C:\tutorial\uldotnet\VBApp. If you choose to use a directory with a different name, use that directory throughout the tutorial.

 Create a Visual Studio project
  1. Create a Visual Studio project.

    • In the Visual Studio File menu, click New » Project.

    • The New Project window appears. In the left pane, expand either the Visual Basic folder or the Visual C# folder. Click Smart Device for the project type.

      In the right pane, click a Smart Device Project and name your project VBApp or CSApp, depending on whether you are using Visual Basic or C# for the programming language.

    • Enter a Location of C:\tutorial\uldotnet and click OK.

    • Click Windows Mobile 5.0 Pocket PC SDK as the target platform and .NET Compact Framework Version 3.5 as the target .NET Compact Framework version. Click OK.

  2. Add references to your project.

    • Add the iAnywhere.Data.UltraLite assembly and the associated resources to your project.

      1. From the Project menu, click Add Reference.

      2. Click iAnywhere.Data.UltraLite and iAnywhere.Data.UltraLite EN (for English) in the list of available references. Click OK to add them to the list of selected components.

        If your desired language is not English, click Browse and locateiAnywhere.Data.UltraLite xx in the UltraLite\UltraLite.NET\ce\Assembly\v2\xx subdirectory of your SQL Anywhere installation, where xx is a two-letter abbreviation for your desired language (for example, use en for English). Click iAnywhere.Data.UltraLite.resources.dll and click Open.

    • Link the UltraLite component to your project.

      In this step, ensure that you add a link to the component, and that you do not open the component.

      1. From the Project menu, click Add Existing Item and browse to the UltraLite\UltraLite.NET\ce subdirectory of your SQL Anywhere installation.

      2. In the Objects of Type list, click Executable Files.

      3. Open the folder corresponding to the processor of the Windows Mobile device you are using. For Visual Studio 2005 and later, open the arm.50 folder. Click ulnet12.dll; Click the arrow on the Add button and click Add as Link.

  3. Create a form for your application.

    If the Visual Studio toolbox panel is not currently displayed, from the main menu click View » Toolbox. Add the following visual components to the form by selecting the object from the toolbox and dragging it onto the form in the desired location.

    Type Design - name Appearance - text
    Button btnInsert Insert
    Button btnUpdate Update
    Button btnDelete Delete
    TextBox txtName (no text)
    ListBox lbNames (no text)
    Label laName Name

    Your form should look like the following figure:

    The Visual Studio form, showing the Insert, Update, and Delete buttons and a text box, list box, and label.
  4. Build and deploy your solution.

    Building and deploying the solution confirms that you have configured your Visual Studio project properly.

    1. From the Build menu, click Build Solution. Confirm that the project builds successfully. If you are building a Visual Basic application, you can ignore the following warning that may appear:

      Referenced assembly 'iAnywhere.Data.UltraLite.resources' is a localized satellite assembly
    2. From the Debug menu, click Start Debugging.

      This action deploys your application to the mobile device or emulator, and starts it. The application is deployed to the emulator or device location: \Program Files\VBApp or \Program Files\CSApp depending on your project name.

      The deployment may take some time.

    3. Confirm that the application deploys to the emulator or your target device and the form (Form1) you have designed is displayed correctly.

    4. Shutdown the emulator or the application on your target device.