Welcome!

Mobile IoT Authors: Elizabeth White, Pat Romanski, Janakiram MSV, Shelly Palmer, Laureen Fagan

Related Topics: Mobile IoT

Mobile IoT: Article

Getting Started with the .NET Compact Framework

Getting Started with the .NET Compact Framework

The .NET Compact Framework is a managed execution environment (a runtime engine) that runs on devices that use the Windows CE operating system - Pocket PC and Windows CE .NET devices. The runtime components also include a large collection of base class libraries that you use in your .NET applications to do everything from displaying UI on the screen to working with files to accessing network resources such as XML Web services. It's a slimmed-down version of the full .NET Framework that you might use to develop applications for servers and desktop PCs.

It does a similar job to Java 2, Micro Edition (J2ME), but the .NET Compact Framework is firmly targeted at higher-end PDAs and PDA- phone hybrids. It's too big to go on the kind of small phones that J2ME CLDC MIDP works on. It's definitely in the same space as J2ME in its CDC (Personal Java) configurations, though.

What Does It Run On?
The .NET Compact Framework currently runs on Windows CE devices only. You can use it with Pocket PC 2000 and Pocket PC 2002 devices, or custom handheld devices using the Windows CE .NET operating system. A version from Microsoft for their Smartphone is expected, although no announcements have been made.

However, it's not necessarily for Microsoft devices only. The specification of the CLR (Common Language Runtime - the runtime engine) is a published standard, so anyone can build one. Recent speculation has suggested that Palm will be supporting it in Palm OS 6.

How Do I Build Applications?
You write applications using Visual Basic .NET or C# using Microsoft Visual Studio .NET 2003. You'll need a PC running Windows 2000 or Windows XP, plus around 4GB of free disk space to run Visual Studio .NET. You can order a DVD containing a 60-day trial version of Visual Studio .NET at http://msdn.microsoft.com/vstudio/productinfo/trial/default.asp. You just have to pay the postage. This IDE provides you with everything you need, including Pocket PC 2002 and Windows CE .NET emulators, so you don't even need a real device.

Visual Studio .NET 2003 will be released in February or March 2003. Don't get the 2002 version - it doesn't support the .NET Compact Framework.

Building an Application
To get started, open Visual Studio .NET 2003 and click on File ->New Project. In the New Project window (see Figure 1), select either Visual Basic or Visual C# projects in the left pane according to your preference, then click the Smart Device Application icon in the right pane. Enter the name you want to give this project (for example, "MyFirstSmartDeviceApplication") and click OK.

Another window appears, this time asking you what kind of project you want, and which platform it should run on. Choose the Pocket PC platform, and the Windows Application project type. Click OK and Visual Studio .NET creates the project for you.

Using the GUI Designer
Now you're working in a familiar Visual Studio .NET drag-and-drop visual designer. You build your user interface by dragging controls from the Toolbox onto the Form. For this simple application, click on the Toolbox tab on the left edge of the screen so that it slides into view, then drag a label onto the Form (see Figure 2).

You can set properties of the control you just dragged on in the Properties window in the lower right corner of the screen. Set the Text property to a suitable value, such as "Hello, World" or perhaps something more original. Play with some of the other properties - click on the Form to select it, then change the Backcolor property, or set the Text of the Form to display a suitable heading on the Form.

One tip for Pocket PC applications: if you want to get the little "OK" icon on the taskbar at the head of your Form, set the MinimizeBox property of the Form to False. The OK icon is actually the "Quit" option for a Pocket PC application. If you don't do this, you just get an "X" icon, which actually means "minimize." (I know - "X" means minimize, whereas on a PC it means quit? Just don't ask - the Pocket PC user interface has been honed through several Microsoft failures in earlier versions, and users seem comfortable with it. This whole subject deserves its own article.)

Testing Your Application
When you're finished, click the Build menu, option Build Solution. If it builds successfully, click the Debug menu, option Start. You'll be asked where to deploy your application. If you have a real Pocket PC device connected to your desktop by a synchronization cradle, or by InfraRed or 802.11b, then you can select Pocket PC Device. Otherwise, choose the built-in Pocket PC 2002 emulator.

If the target device does not have the .NET Compact Framework runtime installed, Visual Studio .NET downloads it and installs it, along with your application. The emulator runs a true Pocket PC operating system in a virtual machine hosted by your desktop PC. The first time you use it, the .NET Compact Framework runtime must be installed into it, as shown in Figure 3.

New Pocket PC devices that come out in 2003 will have the .NET Compact Framework preinstalled, but on older devices you have to install it manually.

If everything has gone well, you'll see your application displayed on the screen of the emulator (see Figure 4).

Summary
You've created your first application. The .NET Compact Framework class libraries are extensive and allow you to create all kinds of sophisticated applications to run on handheld devices. There is an implementation of Windows Forms, which supports the majority of the controls that you can use in desktop applications with the full .NET Framework. There are also classes to allow you to write XML Web services client apps, and to work with SQL Server CE databases on the device, or fetch data from back-end SQL servers over HTTP or via wireless or wireline LAN.

It's an impressive product that allows the .NET developer to easily transfer skills learned with desktop applications to applications on smart devices. Have a go and see what you can do - I think you'll be impressed!

More Stories By Andy Wigley

Andy Wigley is a principal technologist at Content Master Ltd, focusing on mobility. He is the coauthor of Building ASP.NET Applications for Mobile Devices and .NET Compact Framework Developer's Core Reference, both published by Microsoft Press.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
"We've been engaging with a lot of customers including Panasonic, we've been involved with Cisco and now we're working with the U.S. government - the Department of Homeland Security," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
The financial services market is one of the most data-driven industries in the world, yet it’s bogged down by legacy CPU technologies that simply can’t keep up with the task of querying and visualizing billions of records. In his session at 20th Cloud Expo, Karthik Lalithraj, a Principal Solutions Architect at Kinetica, discussed how the advent of advanced in-database analytics on the GPU makes it possible to run sophisticated data science workloads on the same database that is housing the rich...
IoT is at the core or many Digital Transformation initiatives with the goal of re-inventing a company's business model. We all agree that collecting relevant IoT data will result in massive amounts of data needing to be stored. However, with the rapid development of IoT devices and ongoing business model transformation, we are not able to predict the volume and growth of IoT data. And with the lack of IoT history, traditional methods of IT and infrastructure planning based on the past do not app...
DX World EXPO, LLC., a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, will examine the regulations and provide insight on how it affects technology, challenges the established rules and will usher in new levels of diligence...
In the enterprise today, connected IoT devices are everywhere – both inside and outside corporate environments. The need to identify, manage, control and secure a quickly growing web of connections and outside devices is making the already challenging task of security even more important, and onerous. In his session at @ThingsExpo, Rich Boyer, CISO and Chief Architect for Security at NTT i3, discussed new ways of thinking and the approaches needed to address the emerging challenges of security i...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
What sort of WebRTC based applications can we expect to see over the next year and beyond? One way to predict development trends is to see what sorts of applications startups are building. In his session at @ThingsExpo, Arin Sime, founder of WebRTC.ventures, discussed the current and likely future trends in WebRTC application development based on real requests for custom applications from real customers, as well as other public sources of information.
"The Striim platform is a full end-to-end streaming integration and analytics platform that is middleware that covers a lot of different use cases," explained Steve Wilkes, Founder and CTO at Striim, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that Calligo, an innovative cloud service provider offering mid-sized companies the highest levels of data privacy and security, has been named "Bronze Sponsor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Calligo offers unparalleled application performance guarantees, commercial flexibility and a personalised support service from its globally located cloud plat...
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
"DX encompasses the continuing technology revolution, and is addressing society's most important issues throughout the entire $78 trillion 21st-century global economy," said Roger Strukhoff, Conference Chair. "DX World Expo has organized these issues along 10 tracks with more than 150 of the world's top speakers coming to Istanbul to help change the world."
"We provide IoT solutions. We provide the most compatible solutions for many applications. Our solutions are industry agnostic and also protocol agnostic," explained Richard Han, Head of Sales and Marketing and Engineering at Systena America, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We are focused on SAP running in the clouds, to make this super easy because we believe in the tremendous value of those powerful worlds - SAP and the cloud," explained Frank Stienhans, CTO of Ocean9, Inc., in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.