Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 » UltraLite - .NET Programming » Tutorial: Build an UltraLite.NET application

 

Lesson 1: Create 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.

 To create a Visual Studio project
  1. Create a Visual Studio project.

    • From the Visual Studio File menu, choose New » Project.

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

      In the right pane, select 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.

    • Choose Windows Mobile 5.0 Pocket PC SDK as the target platform. 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, choose Add Reference.

      2. Select iAnywhere.Data.UltraLite (CE) from the list of available references. Click Select to add it to the list of selected components.

        If this reference does not appear in the list, click Browse and locate it in the UltraLite\UltraLite.NET\ce\Assembly\v2\ subdirectory of your SQL Anywhere installation. Select iAnywhere.Data.UltraLite.dll and click OK.

      3. Select iAnywhere.Data.UltraLite (CE) EN from the list of available references. Click Select to add it to the list of selected components.

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

      4. Click OK to add the assembly and resources to your project.

    • 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, choose Add Existing Item and browse to the UltraLite\UltraLite.NET\ce subdirectory of your SQL Anywhere installation.

      2. In the Files of Type list, choose 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. Select ulnet12.dll; Click the arrow on the Add button and select Add as Link.

  3. Create a form for your application.

    If the Visual Studio toolbox panel is not currently displayed, from the main menu choose 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, choose 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, choose Start Debugging.

      This action deploys your application to the 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.