Over the years I've developed a "Swiss Army Knife" of tools and techniques for Compact Framework Development (.NET CF). Here are my top ten.
All the code you see in this article is available at http://www.breezetraining.com.au (under "Featured Technical Articles" at the bottom of the home page). I decided to write the samples in VB.NET this time.
In the land of Pocket PC (PPC) and SmartPhone (SP) development, we'd love the devices to have virtually limitless memory and fast CPUs, as we have available in desktop development. Unfortunately we don't; in fact we have pretty tight resources, especially on SPs. So we need to be smart about how our applications run and what we deem important to keep in main memory. These factors should always be in the back of your mind when developing.
The ten tips and tricks, loosely grouped by category:
Getting Faster Form Load Times
1. Default Control Creation - What has my designer done?
2. Form Loading/Unloading
Smarter GUI Management
3. Making lists display what YOU want
Improving Data Access
4. Xml dataset - better read/write performance
5. SQLServerCe - reference. Add, then deploy.
6. SQLClient object
WebService Improvements
7. WebService - Making faster calls
8. WebService - Using a One-Way WebMethod
Miscellaneous Improvements
9. Use Resource Files
10. Network component - detect online/offline
What you need before you begin
To get cracking on Compact Framework development you'll need:
Basically VS.NET 2003 has all the goodies that you need to get started; we just add the latest service pack and updates.
NOTE: Unless otherwise stated, all references are to components within a Smart Device Project. Also, my timings are from the emulator running on my machine: your's may vary. Also, timings are measured in the difference of "ticks" since the device booted up.
A) Getting Faster Form Load Times
This is one area where, with a little thought and re-arrangement, we can get decent performance improvements.
1. Default Control Creation - what has my designer done?
Whenever you create a form, you basically drag n' drop controls onto it without a second thought. Let's see what happens.
We find that the designer isn't as efficient as we'd like, although with .NETCF SP3 Microsoft has made some super optimizations.
- The secret here lies in the code behind section of your form labeled:
#Region " Windows Form Designer generated code ".
This is usually a place where we generally don't do much; it can be seen in Fig. 1.

Fig. 1: This is the code behind form frmUnOptimised.vb; line 8 is the area that the VS.NET 2003 designer generates "automagically" for us.
- Within this region we can optimize our form code by removing lines at the end like:
Me.Controls.Add(Me.Button4)