Developer .NET UPDATE, June 17, 2003
Using the Compact Framework to develop Pocket PC applications is similar to using the Windows .NET Framework to develop desktop applications. Here’s how to create a simple application that's compatible with smart devices, such as a Pocket PC Phone.
June 17, 2003
Developer .NET UPDATE—brought to you by the Windows & .NET Magazine Network
http://www.winnetmag.com
This Issue Sponsored By
DevConnections--Fall 2003 Dates Announced
http://www.devconnections.com
DevConnections Tour--The Conference Comes to You
http://www.devconnections.com/tour
June 17, 2003--In this issue:
1. Developer .NET Perspectives
Using the Compact Framework to Create a Simple Application
2. Announcements
Fight Spam and Viruses, and Secure Exchange 2003!
Designing SQL Server Security for ASP.NET
3. Resource
Featured Thread: The Framework's Impact on AD
4. Events
Security 2003 Road Show
5. New and Improved
Prepare for Exam 70-300
6. Contact Us
See this section for a list of ways to contact us.
Sponsor: DevConnections--Fall 2003 Dates Announced
DevConnections = Microsoft ASP.NET Connections + Visual Studio Connections + SQL Server Magazine Connections + Microsoft Office System Conference. Four conferences for the price of one. Over 170 sessions to choose from.
Jump-start your fall 2003 training plans and secure your seat for DevConnections Fall, held Oct 13 - 15 in Palm Springs, CA. Don't miss this chance to get the latest roadmap from Microsoft, learn practical tips and insights that you'll use on the job immediately, and network with the top gurus in the industry.
Register now to receive the lowest possible registration fee plus access to all four conferences for one low price. Call 800-438-6720 or 203-268-3204 for more information.
http://www.devconnections.com
1. Developer .NET Perspectives
by Marquis Howard, [email protected]
Using the Compact Framework to Create a Simple Application
The Windows .NET Compact Framework consists of many new and exciting technologies. Microsoft refers to the Compact Framework as part of the Smart Device Extensions, which is a set of technologies geared toward smart devices.
In "Visual Studio .NET and Windows 2003 Features, Part 6" (http://www.winnetmag.com/articles/index.cfm?articleid=39019), Bill Sheldon introduced you to smart devices. Smart devices are growing in popularity and becoming part of the new business model emerging around the world. To be labeled "smart," a device must provide users with the ability to conduct business detached (wireless), away from the home or office. In addition, the device must allow a client to communicate to a remote server through wireless transmission.
One device that fits these criteria is the Pocket PC Phone, which combines the Pocket PC (also a smart device) with a phone. The Pocket PC Phone is extremely useful because you can place phone calls and use programs such as Microsoft Excel or Microsoft Word. In other words, you have one less gadget to carry around, which helps make the Pocket PC Phone one of the hottest tools for power users. So, if you can't live without your PDA and need to carry a phone around, the Pocket PC Phone is exactly what the tech doctor ordered.
For those of you who don't want to carry around what some might consider a Captain Kirk communicator on steroids, you're in luck. Microsoft has introduced the Smartphone. The Smartphone integrates PDA-type functionality into a phone-centric handset. Microsoft designed the Smartphone for one-handed operation, with the option to use keypad access. The Smartphone is optimized for voice and text communication, wireless access to Microsoft Outlook, and support for encrypted browsing of Internet information and services. For more information about the Smartphone, go to the Smartphone FAQs Web page at this URL:
http://www.microsoft.com/mobile/smartphone/getstarted/faq.asp
You can easily create a simple application that's compatible with smart devices such as a Pocket PC Phone. For simplicity, this application uses the emulator that Visual Studio .NET 2003 includes as an option for a targeted device. The data source is a DataTable (i.e., a table of in-memory relational data) that you'll create. You'll bind to a ListBox control and a Label control. The application's code demonstrates basic data binding in the Compact Framework.
Open Visual Studio .NET 2003 and select New, Project on the File menu. In the Project Type pane on the left side of the New Project dialog box, select Visual C# Projects. In the Templates pane on the right side, click Smart Device Application. Enter a project name in the Name text box. Click OK to bring up the Smart Device Application Wizard.
The Smart Device Application Wizard has two options: "What platform do you want to target?" and "What project type do you want to create?" Accept the default selections of Pocket PC and Windows Application, respectively. Click OK to create your new project.
You're now in Visual Studio .NET's Design window, which looks almost identical to the Design window for a regular WinForm application, with the exception of the form's size. The Design window automatically sizes the form to fit the targeted device, which in this case, is a Pocket PC.
From the Toolbox, drag a Label control and a ListBox control onto the form. As you might have noticed, the Toolbox you use to create Pocket PC applications has many of the same controls as the Toolbox you use to create desktop applications.
Now you need to add code to populate the ListBox control with days of the week. Double-click the form area (don't click near either of the controls) to open the code view and automatically add a handler for the forms load event. Copy and paste the following code into the Form1_Load method:
DataTable dataTable = new DataTable();
DateTime start = DateTime.Parse("6/1/2003");
DateTime end = DateTime.Parse("6/7/2003");
string currentDay = "";
string[] dateArray = null;
dataTable.Columns.Add("Day");
dataTable.Columns.Add("Date");
while(start {
currentDay = start.DayOfWeek.ToString() + "^" + start.ToString();
dateArray = currentDay.Split(new char[] {'^'});
dataTable.Rows.Add(dateArray);
start = start.AddDays(1);
dateArray = null;}
listBox1.DataSource = dataTable;
listBox1.DisplayMember = "Day";
label1.DataBindings.Add(new Binding("Text",dataTable,"Date"));
The last step before running the project is to look at the toolbars at the top of the Design window. You should see a drop-down box that contains a list of deployment devices. Make sure that Pocket PC 2002 Emulator (Default) is selected; if not, select that option.
Save your project and press F5 to run and deploy it. When you deploy a project to a device emulator, you need to be more patient than when you're deploying a local project because Visual Studio .NET 2003 needs to load the files into the emulator's virtual operating environment, then trigger the application to start.
With the form loaded in the emulator, you have a list box containing the days of the week. If you click any one of those days, the corresponding date is reflected in the label control by way of data binding.
That's all the steps you need to take to create a simple application for a smart device such as a Pocket PC or Pocket PC Phone. As you can see, using the Compact Framework to develop Pocket PC applications is similar to using the Windows .NET Framework to develop desktop applications.
Sponsor: DevConnections Tour--The Conference Comes to You
Can't make it to one of our major conferences? We will bring the conference to you. Join Paul Litwin and Carl Franklin for 2 days of solid, in-depth training in ASP.NET and VB .NET. Special keynote by Microsoft's Rob Howard.
Attend either the ASP or VB track for the entire two days or move from one track to the other as you desire. Don't miss this chance to get in-depth training from the experts in a highly interactive environment. Bring your questions and get the answers you need. You'll discover new tips and shortcuts to help you build better and more secure applications and web services faster.
Coming to a city near you. Get ready for the transition in development by learning from the best and keep your competitive edge.
Register today before these events sell out:
http://www.devconnections.com/tour
2. Announcements
(brought to you by Windows & .NET Magazine and its partners)
Fight Spam and Viruses, and Secure Exchange 2003!
Check out our June Web events, and get expert advice that will help you fight spam and viruses and help you assess the security risks of Exchange 2003. There's no charge for any of these eye-opening, educational events, but space is limited so sign up now!
http://www.winnetmag.com/seminars
Designing SQL Server Security for ASP.NET
Be one of the first 50 registrants to SQL Server Magazine University's 1-hour live Web seminar, and receive a free copy of presenter Morris Lewis's new book SQL Server Distilled! This online event will be Wednesday, June 25, 2003, at 11:00 A.M. Eastern time. Discover options for authentication available to ASP.NET applications and .NET Web services and learn how to integrate them with SQL Server to create a more secure environment. Subscribers to SQL Server Magazine pay only $59 ($99 for non-subscribers). Register now by calling 800-793-5697 or 970-663-4700, or register online at
http://www.sqlmag.com/ssmu/seminars/index.cfm?event_id=54
3. Resource
Featured Thread: The Framework's Impact on AD
Forum junior member nelita wants to know the effect that the Windows .NET Framework has on Active Directory (AD). To join the discussion, go to the following URL:
http://www.winnetmag.com/forums/rd.cfm?cid=55&tid=59965
4. Events
(brought to you by Windows & .NET Magazine)
Security 2003 Road Show
Join Mark Minasi and Paul Thurrott as they deliver sound security advice at our popular Security 2003 Road Show event.
http://www.winnetmag.com/roadshows/security2003
5. New and Improved
by Sue Cooper, [email protected]
Prepare for Exam 70-300
Transcender announced SolutionCert 4.0 and SolutionFlash 4.0, study tools to prepare you for Microsoft Exam 70-300: Analyzing Requirements and Defining Microsoft .NET Solution Architectures. You can use SolutionFlash to test your knowledge of exam concepts. The software's 400 questions are presented in a flash-card format. You can grade your answers as you take the standard quizzes, or you can create customized or randomized quizzes. Print options let you review and print items by topic, section, or string. SolutionCert includes three exams with case-study questions. SolutionCert offers customized and randomized exam options, a score report history to discover the areas in which you need improvement, and detailed answer explanations with references to Microsoft study materials. Contact Transcender at 615-726-8779 or [email protected].
http://www.transcender.com
Sponsored Link: FaxBack
Integrate FAX into Exchange/Outlook (Whitepaper, ROI, Trial)
http://www.faxback.com/w2ksponorlink/
6. Contact Us
About Developer .NET Perspectives -- [email protected]
About the newsletter -- [email protected]
About technical questions -- http://www.winnetmag.com/forums
About product news -- [email protected]
About your subscription -- [email protected]
About sponsoring UPDATE -- [email protected]
This email newsletter is brought to you by Windows & .NET Magazine, the leading publication for IT professionals deploying Windows and related technologies. Subscribe today.
http://www.winnetmag.com/sub.cfm?code=wswi201x1z
Copyright 2003, Penton Media, Inc.
About the Author
You May Also Like