Home > Store

Microsoft .NET Compact Framework Kick Start

Register your product to gain access to bonus material or receive a coupon.

Microsoft .NET Compact Framework Kick Start

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2004
  • Dimensions: 7-3/8" x 9-1/8"
  • Pages: 600
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32570-5
  • ISBN-13: 978-0-672-32570-0

The primary goal of .NET Compact Framework is to bring the familiar experience of developing .NET applications for the desktop to the device world. Of the approximately six million Microsoft desktop developers in the world, it is estimated that perhaps two hundred thousand will turn their attention to the device world using the enabling technology of the .NET Compact Framework.To facilitate the goal of showing readers how to develop applications for the .NET Compact Framework, the book contains in-depth treatment in the following topic areas: Windows Forms and Threading, Network Programming, ADO.NET Dataset, XML Serialization, SQL CE, Web Services, and performance management. Each concept is accompanied with a sample application that illustrates its implementation on the .NET Compact Framework. For the convenience of the reader, each sample application will be offered in both C# and Visual BASIC. Developers can use this source code as a springboard for creating their own device side database applications.

Downloads

Downloads

All the examples developed for the book in one convenient download - 6,510 KB -- code.zip

Sample Content

Online Sample Chapters

Designing GUI Applications with Windows Forms

Designing GUI Applications with Windows Forms

Table of Contents



Introduction.

What's in This Book. Conventions Used in This Book. What You'll Need. Online Resources.



1. Setting Up Your Development Environment.

Smart Device Extensions and the .NET Compact Framework.

System Requirements. The Development Process Using Smart Device Extensions. Creating a New Application for Pocket PC Devices. Opening an Existing Smart Device Extensions Project.

Targeting Nonstandard Devices.

How Visual Studio Communicates with Devices. Installing the .NET Compact Framework Manually. Devices with Unusual Memory Maps. Connectivity Summary and Troubleshooter.

In Brief.



2. Introducing the .NET Compact Framework.

Why the .NET Compact Framework? Examining the .NET Compact Framework in Detail.

The Common Language Runtime. Comparing the .NET Compact Framework CLR to the Desktop CLR. The .NET Compact Framework Class Libraries.

In Brief.



3. Designing GUI Applications with Windows Forms.

Investigating Unsupported Controls in the .NET Compact Framework. Investigating Unsupported System.Windows.Forms Functionality in the .NET Compact Framework. Working with the Visual Studio .NET Form Designer.

The Form Designer Window. The ToolBox Window. The Properties Window. Adding Events Handlers.

Understanding the Different Windows Forms Target Platforms.

Understanding Windows CE .NET Projects. Understanding Pocket PC Projects.

Working with the Form Control.

Understanding the Effects of the FormBorderStyle Property. Using the ControlBox Property. Understanding the MinimizeBox and MaximizeBox Properties. Understanding the WindowsState Property. Understanding the Size Property. Setting the Location of the Form by Using the Location Property.

Programming the Button Control. Using the TextBox Control. Using the Label Control. Working with RadioButton Controls. Using the CheckBox Control. Using the ComboBox Control. Using the ListBox Control. Using the NumericUpDown Control. Using the DomainUpDown Control. Programming the ProgressBar Control. Using the StatusBar Control. Using the TrackBar Control. Using the ToolBar Control.

Adding a ToolBar Control to an Application. Handling a ToolBar's ButtonClick Event.

Adding Menus with the MainMenu Control. Using a ContextMenu Control in an Application. Using the Timer Control. Using the OpenFileDialog and SaveFileDialog Controls. Using the Panel Control.

Unsupported Functionality.

Using the HScrollBar and VScrollBar Controls. Using the ImageList Control. Using the PictureBox Control. Using the ListView Control.

Adding Columns to the ListView. Adding Items to the ListView Control. Determining the Selected Item. Additional ListView Control Properties.

Using the TabControl Control. Using the TreeView Control.

Understanding TreeView Properties. Adding TreeNodes to a TreeView Control. Determining the Selected TreeNode.

Working with the DataGrid Control.

Populating the DataGrid Control. Customizing the DataGrid Control. Determining the Selected Row or Selected Cell in the DataGrid.

In Brief.



4. Using Threads and Timers in the .NET Compact Framework.

Threads, Timers, and Windows CE. The Thread Class. Understanding Thread Basics.

Creating and Starting a Thread. Writing Code to Start a Thread. Suspending a Thread. Using Threads with User Interface Controls. Quitting Threaded Applications. Coding a Multithreaded Application: SimpleThread.

Coordinating Threads with the Mutex Class.

Suspending and Resuming Threads with Mutexes. Examining a Sample Application: SuspendAndTerminateThreads.

Blocking until a Thread Finishes.

Waiting for a Thread: The JoinDemo Application.

Controlling Access to Data Objects with the Monitor Class.

Simulating the Producer-Consumer Problem.

Managing Multiple Threads with a Thread Pool.

Controlling Threads with the ThreadPoolDemo Application.

Timers.

Creating a Timer. Setting the Tick Interval. Suspending and Resuming Timers. Manipulating Timers with a Sample Application.

Updating Variables with the Interlocked Class.

Incrementing a Variable. Decrementing a Variable. Exchanging a Value into a Variable.

In Brief.



5. Network Connectivity with the .NET Compact Framework.

Working with Sockets.

Choosing a Protocol: TCP/IP versus UDP. Understanding IP Implementations: IPv4 versus IPv6.

Socket Programming with the .NET Compact Framework.

Making a Connection as a Client. Receiving a Connection as a Host. Reading and Writing with a Connected Socket. Sample Application: Remote Hello.

Serializing Objects for Transmission through a Socket.

Serializing Packets: Sample Application.

Using UDP Packets.

Writing Code for UdpClient. Writing for the UdpClient: Sample Application.

Multicasting with UDP Packets.

Sending Multicast Packets. Receiving Multicast Packets.

Communicating with Remote Servers through the HTTP Protocol.

Nuts-and-Bolts Usage of HttpWebRequest. Coding Sample for HttpWebRequest. Writing Applications with the HttpWebRequest: WebHello Sample.

Communicating with Remote Servers through the HTTPS Protocol. Communicating through the Device IrDA Port.

Using the IrDAClient to Access the Device IrDA Port. Connecting to an IrDA Port as a Client. Establishing an IrDA Connection as a Server. Reading Data from an IrDAClient. Writing Data to an IrDAClient. Sample Application: IrDAChat.

In Brief.



6. ADO.NET on the .NET Compact Framework.

Introducing ADO.NET on the .NET Compact Framework. Caching Data with the DataSet.

Looking Inside the DataSet: DataTables, DataRows, and DataColumns. Inserting Data into a DataSet. Building a DataSet to Hold a Phone Book. Extracting Data from a DataSet. Altering Data in a DataSet. Designing a PhoneBook Application with a DataSet. Troubleshooting Common DataSet-Related Errors.

Understanding Constraints.

Adding Constraints to a DataSet. Adding a UniqueConstraint. Working with a UniqueConstraint by Example. Preventing NULL Values in a DataColumn.

Setting Up Autoincremented Fields.

Creating Autoincremented Field Code by Example. Updating the PhoneBook Application with Constraints and Autoincremented Fields.

Modeling Relational Data with the DataSet.

Deriving DataColumn Values with Expressions and Computed Fields. Expressing Parent-Child Relationships in a DataSet.

Creating Bindable Views of Data with a DataView.

Sorting with the DataView. Sorting and Filtering Data in a Sample Application. Tracking Changes in a DataRow. Filtering with the DataView. Adding Data into a DataView. Using a DataView in a Sample Application: DataView_SortByRowState_AddTables.

Binding Data to a Control.

Binding to a DataGrid. Using Data Binding in a Sample Application.

Comparing the Compact DataSet with the Desktop DataSet. In Brief.



7. Programming with Microsoft SQL Server CE.

Investigating the Features Supported by Microsoft SQL Server 2000. Creating a Microsoft SQL Server CE Database. Adding Structure to a Microsoft SQL Server CE Database. Populating a Microsoft SQL Server CE Database. Retrieving Data by Using SqlCeDataReader.

Using Parameterized SQL Commands.

Filling a DataSet by Using the SqlCeDataAdapter.

Handling the FillError Event.

Updating the Microsoft SQL Server CE Database by Using the SqlCeDataAdapter.

Handling SqlCeDataAdapter Update Events.

Generating SqlCommand Objects with the SqlCeCommandBuilder. In Brief.



8. XML and the DataSet.

XML and the .NET Compact Framework DataSet. Loading XML into a DataSet.

Loading from a File. Loading Data from a Stream. Inferring Schema.

Saving a DataSet as XML.

Saving to a File. Saving Data to a Stream. Writing Schema with the XML Data.

Loading and Saving XML in a Sample Application. Modeling Relational Data with XML Schemas.

Examining XML with the XML_DataSetView Utility. Examining a Simple Schema that Describes a Single Table. Autoincremented Fields and Unique Constraints. Describing Multiple Tables, ForeignKeyConstraints, DataRelations, and Computed Fields with XML Schema. Creating XML Data with the XML_Creator Utility.

Loading and Saving Schema Alone. Writing a DataSet to XML without Schema Information. Reading a DataSet from XML, Ignoring Schema Information. Inferring Schema. Using XML to Design a DataSet.

Schema Editing with the IDE.

Saving and Loading DataSets as XML DiffGrams.

How to Read a DiffGram. When to Use DiffGrams.

In Brief.



9. Using XML Web Services.

Creating a Simple XML Web Service. Understanding the .NET Framework Web Service Client. Creating a Client for the Simple XML Web Service.

Adding a Web Reference to a Client Application. Viewing the Proxy Class. Consuming the QuotableQuotes Web Service. Asynchronous Consumption of the Simple Web Service.

Consuming a Web Service That Uses a DataSet. Consuming Web Service That Exposes a Typed DataSet. In Brief.



10. Manipulating XML with the XmlTextReader and the XmlTextWriter.

XML Architecture Overview. Working with the XmlTextReader. Loading XML Data into an XmlTextReader.

Loading an XML Stream from the Local File System. Loading an XML File from a Remote Location.

Using the XmlTextReader's Namespaces Property. Understanding the Normalization Property. Controlling White-Space Interpretation with the WhitespaceHandling Property. Using the XmlResolver Property. Reading XML Nodes.

Reading XML Nodes with the Read Method. Reading the Start Element Tag. Reading Element Content as a String. Jumping to an Element's Content.

Reading XML Attributes.

Reading Attributes without Moving the Reader. Reading Attributes by Using Horizontal Movement.

Understanding How to Perform Full-Content Reads.

Reading All Content as String Data. Reading String Data in Chunks. Reading Binary-Encoded Data. Reading Element Content as Markup.

Skipping over Nodes. Closing the XmlTextReader. Working with the XmlTextWriter.

What Is Not Supported?

Creating the XmlTextWriter. Manipulating Namespace Support. Formatting the XmlTextWriter's Output. Writing an XML Declaration. Writing XML Elements. Writing XML Attributes. Writing xml:space and xml:lang Attributes. Writing Element and Attribute Content. Converting .NET Compact Framework Data Types through XmlConvert. Writing Raw XML Markup. Writing Other Nodes.

Writing Comments. Writing CDATA Sections.

Writing Processing Instructions. Writing White-Space Characters. In Brief.



11. Working with the XML Document Object Model.

Processing XML by Using the Document Object Model. Differences from the Desktop .NET Framework. Loading the XML DOM. Navigating the XML DOM.

Navigating Using HasChildNodes and ChildNodes. Navigating by Using Item Indexer Properties. Navigating by Using FirstChild and NextSibling. Navigating by Using ParentNode and OwnerDocument.

Accessing Text from Elements. Accessing Markup from Nodes. Accessing an Element's Attributes. Accessing Other XmlNodes. Searching an XML Document Node Tree. Creating XmlNodes. Creating XmlDeclarations. Creating XmlElements. Creating XmlAttributes. Creating Other Node Types. Inserting XmlNodes. Using the AppendChild and PrependChild Methods. Working with the InsertBefore and InsertAfter Methods. Inserting XmlAttributes into an XmlDocument. Replacing the XmlNodes within an XmlDocument. Removing XmlNodes for an XmlDocument. Removing XmlAttributes from their XmlElements. Writing the XmlDocument. In Brief.



12. Interacting with Native Code.

Understanding When to Call Native Code. Calling Native Code: Quick Start.

Calling Native Code with Minimal Steps.

Marshalling the Fundamental Data Types.

Passing 32-bit Signed Integers. Passing 32-bit Unsigned Integers. Passing Single Precision Floating-Point Types. Passing Signed Long Integer Types. Passing Unsigned Long Data Types. Passing Short Integers. Passing Unsigned Short Integers. Passing Single Characters. Passing Bytes. Passing Boolean Values. Passing a DWORD. Passing an IntPtr. Passing Non-Mutable Strings. Passing Mutable Strings with System.Text.StringBuilder. Converting Data to Strings with the FundamentalToString Sample Application.

Marshalling Simple Structures.

Marshalling Shallow Structures with the MarshalShallowStruct Sample Application.

Passing Nested Structures by Using Custom Marshalling Code.

Marshalling Deep Structures with the MarshalDeepStruct Sample Application.

Calling the Windows CE Operating System.

Calling the Windows CE API to Play a Sound. Putting It All Together with a Sample Application: PlaySound.

Accessing COM Components from the .NET Compact Framework. In Brief.



13. Exploring .NET Reflection.

Understanding the .NET Compact Framework Reflection API. Loading .NET Assemblies. Discovering Type Information.

Retrieving Type Information with the GetType Method. Retrieving Type Information from a Loaded Assembly.

Creating Type Instances by Using ConstructorInfo.

Using the GetConstructors Method. Retrieving Individual ConstructorInfo Objects with GetConstructor. Creating Object Instances with the ConstructorInfo Class.

Invoking Methods by Using the MethodInfo Class.

Working with the GetMethod Method. Invoking a Method with the MethodInfo Class.

Using Reflection to Manipulate Object State.

Discovering a Type's Field Information by Using the GetFields method. Discovering a Type's Field Information by Using GetField Method. Using the FieldInfo Class to Retrieve a Field's Value. Using the FieldInfo Class to Change a Field's Value. Discovering a Type's Property Information by Using the GetProperties Method. Discovering a Type's Field Information by Using the GetProperty Method. Using the PropertyInfo Class to Retrieve and Change the Value of the Property.

Adding Custom Metadata to .NET Elements.

Defining a Custom Attribute. Retrieving Custom Attributes.

In Brief.



14. Cryptography.

Cryptography on the .NET Compact Framework.

Performing Cryptography with the ManagedCryptoAPI Class.

Invoking the CryptoAPI.

Using Handles to Interact with CryptoAPI. Understanding the CryptoAPI Context.

Computing a Hash.

Looking Inside ManagedComputeHash. Computing a Hash with a Sample Application.

Encrypting and Decrypting Data by Using a Password.

Looking Inside PasswordEncrypt. Looking Inside PasswordDecrypt.

Using Session Keys to Encrypt and Decrypt Data.

Storing a Session Key for Use Only by the Device That Created It. Importing a Previously Saved Session into the Same Device That Created It. Sharing a Session Key with a Remote Device. Encrypting and Decrypting by Using a Handle to a Session Key.

Determining CryptoAPI Constants with the ConstFinder Sample Application. In Brief.



15. Measuring the Performance of a .NET Compact Framework Application.

Using a Stopwatch Timer to Measure Code Execution Time. Using .NET Compact Framework Performance Counters.

Turn On the .NET Compact Framework Performance Counters. Viewing the Performance Counters. Understanding the Performance Counters. Understanding the .NET Compact Framework's Garbage Collector. The NetCF Performance Counter Explorer.

In Brief.



16. Deploying a .NET Application.

Packaging a .NET Compact Framework Application. Using Visual Studio .NET to Package an Application. Using CAB Wizard to Package an Application.

Specifying the Application Version in the Version Section. Understanding the CEStrings Section. Specifying Custom Substitution Strings in the Strings Section. Understanding the DefaultInstall Section. Specifying the Desktop Location of the Application in SourceDisksNames Section. The SourceDisksFiles Section. Specifying the Final Application Destination Directory in the DestinationDirs Section. Running the CAB Wizard.

Distributing a .NET Compact Framework Application.

Distributing Your Application from a Web Site. Distributing Your Application from a File Share. Distributing Your Application on a Memory Card. Distributing Your Application Through ActiveSync.

In Brief.



17. Developing for the SmartPhone.

Introducing the SmartPhone. Developing for the SmartPhone by Using the .NET Compact Framework.

Miscellaneous SmartPhone OS Issues.

Writing an Application for SmartPhone-XMLDataSetViewer.

Building the DataSetViewer from Scratch-Tutorial Steps. Using the XMLDataSetViewer.

In Brief.



Index.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020