Problem solve Get help with specific problems with your technologies, process and projects.

Your first app with the .NET Compact Framework and smart device extensions

Developers familiar with the .NET Framework should have no problem creating apps for smart devices in the .NET Compact Framework. This tip shows how to create a 'Hello World' app.

Please let other users know how useful this tip is by rating it below. Do you have a tip or code of your own you'd...

like to share? Submit it here.


Microsoft's .NET Compact Framework was developed and designed for various smart devices like PDAs. The .NET Compact Framework is a subset of the .NET Framework that provides support for managed code and XML Web services. Hence, the developers who are familiar with the .NET Framework should have virtually no learning curve when creating applications for these smart devices. In this tip, we will create a small Winforms-based 'Hello World' application.

Installation of smart device extensions is quite easy and it is integrated with Visual Studio .NET, so you can directly create projects for smart devices as shown below.

Figure 1

Once we choose to create a smart device application, a Smart Device Application Wizard pops up asking us the Target Platform (Windows CE or Pocket PC) and the type of the application we need to create, as shown below.

Figure 2

For this tip, I have selected the Pocket PC environment and a Winforms-based application. Clicking OK lets Visual Studio .NET create a Winform-based application for us, opening the first form for us. Over here, we don't have all the controls available to us. Below is the list of controls you get by default.

Figure 3

We will drag and drop a button control on our form and write our code in the OnClick event of the button control.

Figure 4

Double clicking on the button control will take us to OnClick event method. We will just give a message box here that greets us with "Hello World."

private void button1_Click(object sender, System.EventArgs e) 
{ 
       MessageBox.Show("Hello World"); 
}

You can run this project by pressing F5. It will ask you where you want to deploy your application, on the actual device or the emulator. You can attach the real device to your PC for deployment. Here, we will chose to do it on the emulator. It first installs the Runtime environment for our managed application and then deploys our application on it. Installation of the Runtime is a one time activity.

Figure 5

We can see our 'Hello World' application on the emulator as shown below. Clicking on the button gives the message box saying "Hello World."

Figure 6

So, as you can see, if you are familier with VS.NET and the .NET Framework, creating applications for smart devices can be very easy.


Source: DotNetExtreme.com

Dig Deeper on .NET mobile application development

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

Close