Since i have to go to college i got on idea to preform a simple C# Syntax highlighting for my HP ipaq 1710,dont laugh at me when i tell you that i tried to create just window form without anything else and copy it to my Pocket PC,i use windows mobile 2003 SE with 1.0 Compact framework,but when i try to run it it give me an exception like

PPC.exe
TypeLoadException
Could not load type
System.Windows.Forms.Form from
assembly System.Windows.Forms,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089.

So i have VS 2005 and i have installed Compact framework 2.0,but it dont offer me a template for mobile programming like in VS 2003,can someone help me just give me the sample code for loading form on PDA or explain how this things work?? :-| :sad:

Dani AI

Generated

Short diagnosis and root cause: the TypeLoadException shown by almost always means the EXE or one of its DLLs was built against the desktop .NET instead of the .NET Compact Framework (or a desktop class library was referenced). Pocket PC devices expect Compact Framework assemblies; a desktop-built WinForms EXE copied to the device will fail at runtime. The safe fix is to build a Smart Device (Pocket PC) project so Visual Studio links the Compact Framework versions of System.Windows.Forms and mscorlib. (pcreview.co.uk)

Quick corrective steps (summary): create a new project with File -> New -> Project -> Smart Device -> Pocket PC 2003 -> Device Application and pick the CF version (1.0 or 2.0) that matches the device ROM. If Visual Studio 2005 does not show Smart Device templates, rerun the VS installer and enable the Smart Device Programmability feature (or install the appropriate Windows Mobile SDKs/emulator images). Note: Express SKUs do not support Smart Device tooling — Standard/Professional or above is required for integrated templates and emulators. (packtpub.com)

Practical checklist and a minimal example:

  • Do not copy a desktop EXE to the PDA. Create a Smart Device project and add the source files there.
  • Recreate any class libraries as Smart Device Class Library projects so they link against Compact Framework assemblies.
  • Install the correct CF CAB (for CF2.0 or CF3.5) on the device/emulator if the ROM lacks it.
  • Deploy via the Device Emulator Manager or ActiveSync/WMDC and rebuild before deploying.

Minimal Program pattern (Compact Framework):

static class Program
{
    static void Main()
    {
        Application.Run(new MainForm());
    }
}

Deployment and CF CAB details are covered in Compact Framework deployment guides. (codeproject.com)

Notes tied to the thread: was right to check references — the important point is those references must be the Compact Framework versions, not desktop DLLs. ’s pointer to Pocket PC resources/SDKs is on-target — the SDKs and emulator images often add the missing templates and CABs. Rebuild every binary as a Smart Device target and the TypeLoadException should disappear.

Recommended Answers

All 4 Replies

ok

ok

why did you post this? jw.

but on the topic.
do you have all to correct references added?
with the templet in vs.net2003 it adds the following references check that you have them

MSCorLib -- CE framework
System
System.Data
System.Drawing
System.Windows.Forms -- i would guess this is missing from yours
System.XML

Check this out, it is just a little site that I made for a class, but it may help. It is specifically for writing code for use on a pocket pc. It's kind of old, and I have done little more than look at it for a while, but it has a lot of useful links and stuff.

why did you post this? jw.

Sorry for that

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.