Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Csharp Builder Kick Start
Nội dung xem thử
Mô tả chi tiết
[ Team LiB ]
• Table of Contents
• Index
• Examples
C# Builder Kick Start
By Joe Mayo
Publisher: Sams Publishing
Pub Date: October 08, 2003
ISBN: 0-672-32589-6
Pages: 480
C#Builder Kick Start provides a rapid overview of the C#Builder tool, a Borland developer's
introduction to C# explaining the new forms and interfaces, and set of examples illustrating the
power of C#, C#Builder, and .NET development. Special attention is paid to differences between
existing Borland tools and development strategies and C#Builder.
[ Team LiB ]
[ Team LiB ]
• Table of Contents
• Index
• Examples
C# Builder Kick Start
By Joe Mayo
Publisher: Sams Publishing
Pub Date: October 08, 2003
ISBN: 0-672-32589-6
Pages: 480
C#Builder Kick Start provides a rapid overview of the C#Builder tool, a Borland developer's
introduction to C# explaining the new forms and interfaces, and set of examples illustrating the
power of C#, C#Builder, and .NET development. Special attention is paid to differences between
existing Borland tools and development strategies and C#Builder.
[ Team LiB ]
[ Team LiB ]
• Table of Contents
• Index
• Examples
C# Builder Kick Start
By Joe Mayo
Publisher: Sams Publishing
Pub Date: October 08, 2003
ISBN: 0-672-32589-6
Pages: 480
Copyright
About the Author
Acknowledgments
We Want to Hear from You!
Introduction
How This Book Is Organized
Conventions Used in This Book
Part I. Overview of C#Builder and the C# Programming Language
Chapter 1. Introducing .NET and the C#Builder IDE
.NET Concepts
Overview of C#Builder
Starting Projects
Running Programs
Toolbar Customization
Using the Tool Palette
About Code Insight
HTML Editor Coding
Controlling the Workspace
Adding Tools
Creating Macros
In Brief
Chapter 2. C# Basics
Value Types and Reference Types
Built-in Types
String Formatting
Keywords and Operators
Statements
Coding with Snippets
Arrays
Enums
Methods
Properties and Indexers
In Brief
Chapter 3. Intermediate C#
Reference Types
Object Construction/Destruction
Object-Oriented Features
Exception Handling
In Brief
Chapter 4. Advanced C#
Operator Overloading and Conversions
Delegates and Events
Attributes
Interfaces
Examples of Interface Implementation
In Brief
Chapter 5. Managing Code and Projects
Debugging Code
Organizing Projects
Referencing Assemblies
Source Code Change Management
Building and Compiling Your Projects
Navigating the Object Inspector
Managing Installed .NET Components
Understanding Your Application with Model View
In Brief
Part II. Windows Forms Client Application Development
Chapter 6. Introduction to Windows Forms and Windows Controls
Creating a Simple Windows Forms Application
Using the Windows Forms Designer
Tips About Wizard-Generated Code
Creating Windows Controls
In Brief
Chapter 7. Windows Forms Dialogs
Overview of Dialogs
MessageBox Dialog
Common Dialog Classes
In Brief
Chapter 8. Windows Forms Resources
Creating Menus for Your Application
Creating Toolbars
Adding Status Bars to Your Application
In Brief
Chapter 9. Windows Forms Graphics with GDI+
GDI+ Basics
Working with Brushes and Pens
Drawing Graphics Objects
In Brief
Chapter 10. Windows Forms User Controls and Components
User Controls
Creating Components
In Brief
Part III. ASP.NET Web Application Development
Chapter 11. Introduction to ASP.NET
ASP.NET Overview
ASP.NET Designer and Wizards
The Tool Palette
The ASP.NET Architecture
Using ASP.NET Controls
Configuring ASP.NET Applications
In Brief
Chapter 12. ASP.NET Application Events and State Management
Application-Level Events
Application State
Session State
In Brief
Chapter 13. ASP.NET Security
Authentication and Authorization
Authenticating Individual Users
Applying Role Authentication for Groups of Users
In Brief
Chapter 14. ASP.NET Custom and User Controls
ASP.NET Control Overview
User Controls
Custom Controls
In Brief
Part IV. Enterprise Application Development
Chapter 15. ADO.NET and File I/O
ADO.NET Overview
ADO.NET Architecture
Understanding Data Providers
Coding an ADO.NET Application
BDP for Microsoft .NET Components
Performing Simple File I/O
In Brief
Chapter 16. Data Binding
Data Binding Overview
Windows Forms Controls
The Windows Forms DataGrid
The ASP.NET Repeater
The ASP.NET DataList
The ASP.NET DataGrid
In Brief
Chapter 17. XML Web Services
Web Services Overview
Building a Web Service
Web Service Attributes
Connecting Clients to a Web Service
In Brief
Chapter 18. Assemblies, Versioning, and Deployment
Understanding Assemblies
Preparing Release Builds
Preparing .NET Applications for Deployment
Deploying .NET Applications
In Brief
Index
[ Team LiB ]
[ Team LiB ]
Copyright
Copyright © 2004 by Sams Publishing
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or
transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without
written permission from the publisher. No patent liability is assumed with respect to the use of the
information contained herein. Although every precaution has been taken in the preparation of this
book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability
assumed for damages resulting from the use of the information contained herein.
Library of Congress Catalog Card Number: 2003110395
Printed in the United States of America
First Printing: October 2003
07 06 05 04 4 3 2 1
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been
appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of
a term in this book should not be regarded as affecting the validity of any trademark or service
mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no
warranty or fitness is implied. The information provided is on an "as is" basis. The author and the
publisher shall have neither liability nor responsibility to any person or entity with respect to any
loss or damages arising from the information contained in this book or from the use of the CD or
programs accompanying it.
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk
purchases or special sales. For more information, please contact
U.S. Corporate and Government Sales
1-800-382-3419
For sales outside of the U.S., please contact
International Sales
1-317-428-3341
Credits
Associate Publisher
Michael Stephens
Acquisitions Editor
Loretta Yates
Development Editor
Songlin Qiu
Managing Editor
Charlotte Clapp
Project Editor
Rebecca Lansberry
Copy Editor
Margaret Berson
Indexer
Heather McNeill
Proofreader
Linda Seifert
Technical Editor
Tony Gravagno
Team Coordinator
Cindy Teeters
Multimedia Developer
Dan Scherf
Interior Designer
Gary Adair
Cover Designer
Gary Adair
Page Layout
Gina Rexrode
Dedication
To my loving children—Jennifer, Joseph, and Kamonchon
There once was a poor schmuck named Joe
Who was born in the city of Chicago
He grew up and married a wife
Who brought great kids to his life
And now his rich face is aglow.
—Joe Mayo
[ Team LiB ]
[ Team LiB ]
About the Author
Joe Mayo is an author, independent consultant, and trainer, specializing in .NET technologies. He
opened the C# Station Web site on July 4, 2000, and has been working with C# and .NET since the
first pre-beta version of the .NET Frameworks SDK was released during the same month. Joe has
been programming computers for over 17 years and is currently an independent consultant,
serving customers in the Denver, Colorado area. You are welcome to contact Joe via email at
[ Team LiB ]
[ Team LiB ]
Acknowledgments
First, I would like to thank my beautiful wife, Maytinee, for her untiring love and support while I
wrote this book. I would also like to thank my children, Jennifer Mayo, Joseph Mayo, and
Kamonchon Ahantric.
Thanks to Tony Gravagno, Technical Editor, whose professional insight and technical prowess were
absolutely invaluable.
Thanks to the people at Sams who worked with me as a team to make this book happen: Loretta
Yates (Acquisitions Editor), Songlin Qiu (Development Editor), Margaret Berson (Copy Editor),
Rebecca Lansberry (Project Editor), and all of the other great people at Sams who contributed.
I would like to thank the people at NSA Geotechnical Services for giving me my first C#
programming job and supporting all my work.
[ Team LiB ]
[ Team LiB ]
We Want to Hear from You!
As the reader of this book, you are our most important critic and commentator. We value your
opinion and want to know what we're doing right, what we could do better, what areas you'd like to
see us publish in, and any other words of wisdom you're willing to pass our way.
As an associate publisher for Sams Publishing, I welcome your comments. You can email or write
me directly to let me know what you did or didn't like about this book—as well as what we can do
to make our books better.
Please note that I cannot help you with technical problems related to the topic of this book. We do
have a User Services group, however, where I will forward specific technical questions related to the
book.
When you write, please be sure to include this book's title and author as well as your name, email
address, and phone number. I will carefully review your comments and share them with the author
and editors who worked on the book.
Email: [email protected]
Mail: Michael Stephens
Associate Publisher
Sams Publishing
800 East 96th Street
Indianapolis, IN 46240 USA
For more information about this book or another Sams Publishing title, visit our Web site at
www.samspublishing.com. Type the ISBN (excluding hyphens) or the title of a book in the Search
field to find the page you're looking for.
[ Team LiB ]
[ Team LiB ]
Introduction
In January 2003, InfoWorld and CNET News.com reported that Borland announced that it had
licensed Microsoft's .NET Framework SDK, stating that they intended to include it in "a product."
Within weeks, Borland made another announcement that one of those products would be a C#
Integrated Development Environment (IDE), code-named SideWinder. On June 24, 2003, Borland
officially released the project that was formerly code-named SideWinder as C#Builder.
This makes Borland the first company to commercially license and release a product with
Microsoft's .NET technology. The significance of this is that you, as a C# developer, have all the
benefits of the .NET platform. C#Builder allows you to write the same C# code and use the same
.NET Framework Base Class Libraries (BCL) as other developers using Microsoft tools. What you get
is value added by Borland's C#Builder IDE, which supports all .NET technologies, including
Windows Forms, ASP.NET, ADO.NET, Web Services, and more. Borland has also created their own
ADO.NET database component called the Borland Data Provider (BDP) for Microsoft .NET. BDP is a
high-performance set of components that target multiple databases, including Microsoft SQL Server
2000, Borland Interbase 7.0, IBM DB2, and Oracle9i.
C#Builder Kick Start is designed to help developers learn how to build .NET applications using
Borland C#Builder. The focus of this book is to move beyond the obvious, explain why things work
as they do, and add value beyond what you will find in C#Builder's technical documentation.
When I first considered writing this book, I started doing research in my own library, which
contains hundreds of books that I've accumulated over the years. I couldn't recall what books I had
that covered IDEs and I looked at each title. It is revealing that I never have owned a single IDE
book, and I pondered the reason why. It seems that I never bought an IDE book because I never
needed it. After more thought, I realized that most people are quite capable of figuring out on their
own how to run a wizard, type in a program, and click the Execute button. What had motivated me
to buy the books that I did in the past was the technical content that helped me learn a new
language or write better software, which I believe is the same motivation for many other
professional software developers. The fact is that the reason people will buy C#Builder is so that
they can be productive in building .NET applications. Being productive with C#Builder is important,
building .NET applications is key, and code is the reason for our profession. Therefore, I wrote this
book with emphasis on code so that professional software developers could quickly learn to use
C#Builder in a productive manner to build .NET applications.
[ Team LiB ]
[ Team LiB ]
How This Book Is Organized
C#Builder Kick Start is divided into four parts:
I— Overview of C#Builder and the C# Programming Language
II— Windows Forms Client Application Development
III— ASP.NET Web Application Development
IV— Enterprise Application Development
Part I: Overview of C#Builder and the C# Programming Language
This part provides information on .NET, introductory material on the C#Builder IDE, and a C#
programming language tutorial.
Chapter 1: Introducing .NET and the C# Builder IDE
Developers who are familiar with programming for other platforms, such as Win32, are often
surprised and wonder about behavior and performance characteristics of the .NET platform.
Developing .NET applications is different, and this chapter begins by explaining those aspects of
.NET that will help you understand many of the questions you'll have. After setting the stage for the
environment you'll be working in, I'll provide an overview of the C#Builder IDE, showing what
things are and information needed for accomplishing basic tasks.
Chapter 2: C# Basics
This is the first of three chapters that teach the amount of C# that you will need to understand
examples in the rest of this book. It includes important information on value and reference types,
operators, statements, loops, methods, arrays, enums, properties, and indexers.
Chapter 3: Intermediate C#
This chapter takes you deeper into C# with more coverage of reference types and their members. It
also covers important aspects of object-oriented programming in C#. The last section explains how
to handle program errors with exceptions.
Chapter 4: Advanced C#
The advanced information in this chapter covers operator overloading, conversions, delegates,
events, and interfaces. The section on interfaces is supplemented with specific examples of how
interfaces are used in .NET.
Chapter 5: Managing Code and Projects
C#Builder has an interactive debugger that includes the ability to set breakpoints with conditions,
watch program state, examine threads, log debugging events, and much more. The C# Project
Manager helps organize project files and references to external libraries and COM objects for COM
Interop. A very powerful tool called Model View allows you to navigate code via its logical structure,
examine types in a manner similar to object and class browsers, and view the relationships
between types. The Model View diagrams are presented as UML static structures.
Part II: Windows Forms Client Application Development
This part provides you with information on how C#Builder allows you to build Windows Forms
applications, user controls, and components. Other things you can do in C#Builder are create
menus and toolbars and work with common dialogs. Sometimes you will need to create your own
custom 2D graphics, which is covered in a chapter on GDI+.
Chapter 6: Introduction to Windows Forms and Windows Controls
This chapter introduces the basics of Windows Forms. It explains the code that C#Builder creates
and shows how to use the visual designer to build graphical user interfaces.
Chapter 7: Windows Forms Dialogs
The Windows Forms library includes classes for using common controls that Win32 programmers
are familiar with. This chapter explains how to use the MessageBox class and then covers each of
the common controls, which are accessible via drag-and-drop operations from the Tool Palette in
C#Builder.
Chapter 8: Windows Forms Resources
Menus, toolbars, and status bars are very common elements for Windows Forms applications. This
chapter explains how to add each of these to your applications. It also shows how to add contextsensitive menus to controls.
Chapter 9: Windows Forms Graphics with GDI+
At some point, most developers need to be able to draw graphics in the client area of a program.
This chapter shows how to use GDI+ to draw 2D graphics in the client area of a Windows Forms
application.
Chapter 10: Windows Forms User Controls and Components
In this chapter, you will learn how to create Windows Forms user controls and components. The
benefits are that you will increase productivity in developing applications by taking advantage of
the inherent properties of reuse that user controls and components can deliver.
Part III: ASP.NET Web Application Development
ASP.NET is the .NET technology for building Web applications. The chapters in this section will
explain more about what ASP.NET is, managing state, securing your site, and creating controls.
Chapter 11: Introduction to ASP.NET
This chapter introduces ASP.NET concepts and shows how to use C#Builder to create Web Forms in
the visual designer. ASP.NET comes with many controls and has a GUI design capability that is as
easy as the one for Windows Forms.
Chapter 12: ASP.NET Application Events and State Management
The Web is inherently stateless, which in the past has made application development on the Web
challenging. ASP.NET has the capability to manage state for an application, and this chapter
explains how it works.
Chapter 13: ASP.NET Security
With all the malicious code and hackers on the Web today, we need a way to secure our sites.
ASP.NET provides a capability known as Forms Authentication. This chapter shows how to
implement and configure Forms Authentication so you can protect your site.
Chapter 14: ASP.NET Custom and User Controls
In this chapter you will learn how to create custom controls and user controls for your ASP.NET
applications. ASP.NET custom controls and user controls are reusable and help increase
productivity in application development.
Part IV: Enterprise Application Development
This part covers the subjects that are essential to enterprise-class applications. It includes building
databases with ADO.NET, binding data sources to Windows Forms, ASP.NET controls, and data
grids, implementing XML Web Services, and application deployment.