[Reference] Smart Device Development Walkthrough: Create a Windows form application for a device

Source: Internet
Author: User

In this walkthrough, you will use Visual Basic or Visual C #
Generate a simple windows form applicationProgram,
Then run the application on the Pocket PC simulation program.
This walkthrough demonstrates the main differences between desktop programming and device programming,
That is, you must specify the target device.
During this drill, the device is a built-in simulation program of the Pocket PC 2003.
--------------------------------------------------
This walkthrough was written using Visual Basic development settings and Visual C # development settings.

This drill consists of five main tasks:
1. Create a device project using Windows Forms
2. Add controls to the form.
3. Add event processing to the control.
4. Select the device to run the project.
5. generate an application and deploy it to the device.
6. Prepare other drills

Select the target device
To ensure that you are prompted to select a device when deploying a solution, complete the following steps.
You are prompted to select a device during deployment.
On the Tools menu, click options ",
Click device tools, and then click general ".
(If "device Tools" are not visible, select "show all settings" at the bottom of the "options" dialog box ".)
Select the "display device options before deploying a device project" check box.

Create an application
The process of creating a Windows form project and adding controls and event processing is the same for the device project and desktop project.
The main difference is that the number of available classes in. NET Compact framework is small.

1. Create a device project using Windows Forms
----------------------------------
(Visual Basic) on the "Files" menu in Visual Studio 2005, click "new project ".
-Or-
(Visual C #) on the "Files" menu in Visual Studio 2005, point to "new", and then click "project ".

In the "new project" dialog box, under "project type,
Expand "Visual Basic" or "Visual C #",
Expand smart devices, and then click Pocket PC 2003 ".

If no language is available at the beginning, expand "other languages ". This display is controlled by the development settings.

Under template, click device application ".
In the Name box, type "devicesample" and click "OK ".
(Only for Visual C #) in the "location" box, confirm the location where you want to store the project file, and then click "OK ".

A representation of a Pocket PC device is displayed in the Windows Forms designer.

2. Add controls to the form
----------------
Drag a button control from the toolbox to the form.
If the toolbox is invisible, click toolbox on The View menu ".
If the device control tab is invisible in the toolbox, right-click the toolbox and Click Show All ".

Right-click the button control and click Properties ".
In the "properties" window, type say hello, and then press enter to set the "text" attribute.

3. Add event processing for the button control
----------------------------
Double-click the button on the form.

Open nowCodeEditor, and the insertion point is in the event handler.

Insert the following Visual Basic code:
MessageBox. Show ("Hello, world! ")
-Or-
Insert the following C # code:
MessageBox. Show ("Hello, world! ");
 
4. Generate and test the application
--------------------
At this time, you will find the difference with the desktop project.
In a device project, you can select a project running position from several targets.
In this walkthrough, select the Pocket PC simulation program.
If the development computer already has a supported physical device, you can also select this physical device.

5. Generate and test the application
--------------------
On the Debug menu, click Start (or start debugging ").
In the "deployment" dialog box, select "Pocket PC 2003 se simulation program" and click "deploy ".

You can view the progress in the progress bar.

When the application is running on the simulation program, click the button to make sure "Hello, world!" appears !".

6. Prepare for other drills
------------------
If you plan to conduct another drill or open another project,
You need to completely close the simulation program and exit the solution.

Close simulation programs and Solutions
A. Click "exit" on the "file" menu of the simulation program ".
B. In the "device simulation program" message box, set "Save before exiting ?" Click "no" for the message ".
C. Click "Stop debugging" on the "debug" menu of Visual Studio ".
D. If a message indicating a lost connection appears, click OK ".
E. Click CLOSE solution on the File menu ".

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.