1. Trang chủ
  2. » Công Nghệ Thông Tin

Sams Teach Yourself More Visual Basic .NET in 21 Days doc

599 387 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 599
Dung lượng 12,81 MB

Nội dung

800 East 96th St.,Indianapolis,Indiana,46240 USA Lowell Mauer More Visual Basic .NET in 21 Days Teach Yourself www.it-ebooks.info Sams Teach Yourself More Visual Basic .NET in 21 Days Copyright ©2002 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, photo- copying, recording, or otherwise, without written permission from the publish- er. 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. Neither is any liability assumed for damages resulting from the use of the information contained herein. For information, address Sams Publishing, 201 W. 103rd Street, Indianapolis, IN 46290. International Standard Book Number: 0-672-32271-4 Library of Congress Catalog Number: 2001093573 Printed in the United States of America First Printing: December 2001 05 04 03 02 4321 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 servicemark. 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 aris- ing from the information contained in this book or from the use of the pro- grams accompanying it. ASSOCIATE PUBLISHER Linda Engelman MANAGING EDITOR Charlotte Clapp ACQUISITIONS EDITOR Sondra Scott DEVELOPMENT EDITOR Susan Shaw Dunn PROJECT EDITOR Anthony Reitz COPY EDITOR Rachel Lopez INDEXER Ginny Bess PROOFREADER Suzanne Thomas TECHNICAL EDITORS Simon Mordzynski Deon Schaffer TEAM COORDINATOR Lynne Williams MEDIA DEVELOPER Dan Scherf INTERIOR DESIGNER Gary Adair COVER DESIGNER Aren Howell PAGE LAYOUT Julie Swenson www.it-ebooks.info What’s New in This Edition? With every release of Visual Basic, Microsoft has added new functionality to enhance the applications that can be created. Visual Basic 6 took the first real step toward a client/server development tool that could create robust Windows applications. This newest release of Visual Basic, titled Visual Basic .NET, makes the jump from a mostly Windows-based application system to a truly dynamic development environment that allows you to design both Windows and Web-centric applications. The previous Sams Teach Yourself More Visual Basic in 21 Days covered many of the more advanced fea- tures of the Visual Basic language. You are probably wondering, “Why should I buy the new edition of this book?” The answer is simple: Microsoft has done it again. Microsoft has dramatically enhanced Web development and language portability from within Visual Basic .NET by using the .NET Framework as the starting point. In addition, every topic in this book includes additions and enhancements. You will see that many of your old friends in the Visual Basic language and development environment have changed to some degree. You will see how to incorporate these new features, func- tions, and controls into your applications. I think you will find this book both informative and useful as a reference after you start coding your applications. Have fun and good luck! —Lowell Mauer Author, Sams Teach Yourself More Visual Basic .NET in 21 Days www.it-ebooks.info Contents at a Glance Introduction 1 WEEK 1 At a Glance 5 Day 1 Writing Professional Visual Basic Applications 7 2The Face of a Windows Application 41 3Creating Simple Forms 77 4 Understanding the .NET Framework 99 5Working with Objects, Collections, and Array Processing 111 6 Understanding Procedures, Functions, and Logic 137 7 Building Complex Forms 159 W EEK 1 In Review 189 WEEK 2 At a Glance 193 Day 8 Designing a Database Application 195 9Processing Data 217 10 Accessing the Database 253 11 Enhancing the Application with Custom Objects 289 12 Working with Crystal Reports 303 13 Coping with Error Handling 331 14 Testing and Debugging the Application 355 WEEK 2 In Review 379 WEEK 3 At a Glance 381 Day 15 Programming for the Internet 383 16 Creating a Web Application 407 17 Adding Data Access to the Web 429 18 Building Online Help 443 19 Tuning and Tweaking Performance 461 www.it-ebooks.info 20 Finishing the Application 479 21 Working with Web Services 511 WEEK 3 In Review 533 Appendix 535 Appendix A Answers to Quizzes and Exercises 535 Index 553 www.it-ebooks.info Contents Introduction 1 WEEK 1 At a Glance 5 DAY 1 Writing Professional Visual Basic Applications 7 A Brief Look at What’s New in Visual Basic.NET 8 Changes to the Visual Basic Language 8 The New Windows Forms 9 The New Web Forms 10 Transitioning from Visual Basic 6 10 Taking a Brief Look at the .NET Framework 12 Understanding the Common Language Runtime 13 Visual Basic and the .NET Framework 14 What Makes a Professional Application? 14 Application Types 15 Picking the Right Application 16 Project Life Cycle 16 Starting a Demo Project 25 The Project 26 Environment Properties 30 Controls Added to the Toolbox 30 LinkLabel 31 NotifyIcon 32 Error Provider 32 ToolTip 33 Controls that Changed 33 Making Controls Come Alive 34 Using Controls Together 34 Summary 38 Q&A 38 Workshop 39 Quiz 39 Exercise 39 D AY 2 The Face of a Windows Application 41 What the Common Dialog Is All About 42 Why Use It? 42 Interfacing with the Common Dialog Controls 43 www.it-ebooks.info The Many Faces of the Common Dialog Control 45 Open and Save Dialogs 45 Colors 52 Accessing Fonts 55 Setting Print Options 57 Help 58 The Three Types of Applications 59 SDI 62 MDI 63 Explorer 70 Summary 74 Q&A 75 Workshop 75 Quiz 75 Exercises 76 D AY 3 Creating Simple Forms 77 Working with Toolbars 77 Adding a Toolbar 78 Other Toolbar Features 83 Adding Menus 84 Creating an Application Menu 84 Creating and Using Context Menus 92 Merging Menus 93 Inheriting Forms 94 Inheriting Forms in Code 94 The Inheritance Picker 95 Summary 97 Q&A 97 Workshop 97 Quiz 98 Exercise 98 D AY 4 Understanding the .NET Framework 99 What Is the .NET Framework? 100 Understanding the Common Language Runtime (CLR) 102 Explaining the Metadata 104 CLR Execution 104 Programming in .NET 107 Identifying the Major Namespaces 107 Visual Basic and the .NET Framework 108 Working with the .NET Tools 109 Summary 110 viii Sams Teach Yourself More Visual Basic .NET in 21 Days www.it-ebooks.info Q&A 110 Workshop 110 Quiz 110 Exercise 110 D AY 5 Working with Objects, Collections, and Arrays 111 What Are Objects and Collections? 112 Objects 112 Collections 113 Using System Objects 114 Accessing Objects 118 Finding the Object’s Class 118 Creating Objects 119 Acting on Objects and Collections 120 Creating Your Own Class 124 Browsing Your Objects 129 Processing Loops 131 Counter Loops 131 Conditional Loops 133 Summary 134 Q&A 134 Workshop 135 Quiz 135 Exercise 135 D AY 6 Understanding Procedures, Functions, and Logic 137 Scoping Out the Variables 138 Defining the Variables 138 Where Do Variables Live? 140 Watching Out for Problems 142 Passing Information 143 Subroutines and Functions 144 Reference or Value 148 The Vulcan Way or Adding Logic to the Program 150 Changing the Flow 150 Summary 156 Q&A 156 Workshop 156 Quiz 157 Exercise 157 D AY 7 Building Complex Forms 159 Designing the Form 159 The Good, the Bad, and the Ugly 160 Contents ix www.it-ebooks.info What Size Is It? 166 Using the Form Editor Features 167 Putting It All Together 169 Menus 171 Toolbars 173 Standard Forms 175 Status Bars 178 Common Dialog Controls 179 The Tab Control 180 Using the Date Controls 181 The MonthCalendar Control 181 The DateTimePicker Control 185 Summary 186 Q&A 186 Workshop 186 Quiz 187 Exercise 187 WEEK 1 In Review 189 Professional Applications and the Windows Interface 189 Using Collections and Other VB Concepts 190 Designing Complex Forms 191 WEEK 2 At a Glance 193 DAY 8 Designing a Database Application 195 What Is a Database? 196 Local Databases 196 Remote Databases 197 Building the Initial Design 198 Choosing the Tasks 198 Setting the Limits 204 Creating the Database 205 Building the Tables 205 Defining the Indexes 208 Building the Application Prototype 209 Using the Data Form Wizard 211 Adding Forms 214 Summary 216 Q&A 216 Workshop 216 Quiz 216 Exercise 216 x Sams Teach Yourself More Visual Basic .NET in 21 Days www.it-ebooks.info DAY 9 Processing Data 217 Designing a Database 218 Laying Out the Database Structure 219 Setting Up Tables and Columns 219 Establishing Relationships 224 Defining Queries 225 Using SQL: The Short Course 226 Using the SELECT Statement 227 Accessing Multiple Tables 228 Creating Calculated Values 229 Changing the Tables Names 229 Filtering the Data 229 Using Table Views 231 Working with Stored Procedures 233 Using Triggers 238 Working with the Visual Database Tools 239 Exploring Data in the Server Explorer 240 Creating the Database 241 Adding Tables and Columns 241 Adding an Index to a Table 243 Adding Views 244 Adding Triggers and Stored Procedures 246 Displaying Data from a Table 247 Using the Database Designer 247 Summary 250 Q&A 251 Workshop 251 Quiz 251 Exercise 251 D AY 10 Accessing the Database 253 Visual Basic and Data Access 253 Data Access Objects 254 ADO versus ADO.NET 254 Working with the ActiveX Data Control 255 Using the ActiveX Data Control 257 Displaying the Data on the Form 261 Knowing the Current Record 262 Programmed Access with the Data Control 263 ActiveX Data Objects 266 Opening a Database 266 Accessing the Data 268 Introducing ADO.NET 273 Contents xi www.it-ebooks.info [...]... 2 In Review 379 Database Design and Access 379 Enhancing the Application 380 Using Crystal Reports 380 Tuning the Application 380 WEEK 3 At a Glance 381 DAY 15 Programming for the Internet 383 Adding Internet Control Access 384 Adding the Browser Control to the Toolbox 384 www.it-ebooks.info xiv Sams Teach Yourself More Visual Basic NET in 21 Days. .. a Visual Basic project, which include forms and modules The remainder of this introduction will talk about some of the changes Microsoft has made to Visual Basic, bringing it into the world of Internet/Web programming Note This book won’t step you through the examples used It assumes that you know how to set properties and add objects to forms www.it-ebooks.info 2 Sams Teach Yourself More Visual Basic. .. 477 www.it-ebooks.info xvi Sams Teach Yourself More Visual Basic NET in 21 Days DAY 20 Finishing the Application 479 Understanding What Makes Up a Windows Application 479 Product-Related Issues 480 Support-related Issues 482 Distributing the Application 485 Understanding the New Deployment Projects 485 Deploying the Application 488 Creating the Deployment... working application The promise of this book is that you will be a Visual Basic programmer capable of creating an advanced Windows and/or Web program This book starts where the Sams Teach Yourself Visual Basic NET in 21 Days ends Now, don’t think that you must read the first book before reading this one—you don’t! However, it’s assumed that you already have a good understanding of the fundamental Visual. .. 2 Sams Teach Yourself More Visual Basic NET in 21 Days Welcome to Visual Basic NET With the release of Visual Basic NET, you can use even more functions, features, and tools when creating an application Even if you’ve been using Visual Basic 5 or Visual Basic 6, Visual Basic NET will look a bit different However, Microsoft has enabled you to customize the interface to make it comfortable for you to...xii Sams Teach Yourself More Visual Basic NET in 21 Days Working with DataSets 274 Retrieving and Viewing Data 279 Updating the Data 282 Using the Data Reader 283 Summary 287 Q&A 288 Quiz 288 Exercise 288 DAY 11 Enhancing the Application with Custom Controls 289 Using Custom Controls ... a little about in the first week Everything within Visual Basic has been NET enabled, providing you with many new tools to create Web-enabled applications in addition to the old, standard Windows applications With each new release of Visual Basic, I’ve found new and better ways of performing some basic functions, or adding new functionality to an application Visual Basic NET has even more neat stuff... original and cumbersome Menu Editor from the first release of Visual Basic Of course, all the changes from Visual Basic 6 are still incorporated into the new release Another major change to the Visual Basic language is the capability to create advanced error handling routines using new functionality for error checking Many other new features have been added to Visual Basic; many will be mentioned in. .. www.it-ebooks.info Writing Professional Visual Basic Applications example, inheritance and threading) and ensure that Visual Basic moves forward into the next generation of Web applications, Microsoft decided to build Visual Basic NET from the ground up on the new NET Framework Visual Basic NET enables a fundamental shift from traditional Windows development to building next-generation Web and Windows applications... easier to enhance your applications There are too many changes in Visual Basic NET to list in this introduction or even in this entire book You’ll find that almost everything has changed to some degree But don’t be worried—it’s still the same Visual Basic you’ve come to love In my opinion, all these changes have made developing a Visual Basic application easier One change is the way forms are supported . 211 Adding Forms 214 Summary 216 Q&A 216 Workshop 216 Quiz 216 Exercise 216 x Sams Teach Yourself More Visual Basic .NET in 21 Days www.it-ebooks.info DAY. St.,Indianapolis,Indiana,46240 USA Lowell Mauer More Visual Basic .NET in 21 Days Teach Yourself www.it-ebooks.info Sams Teach Yourself More Visual Basic .NET

Ngày đăng: 23/03/2014, 15:20

TỪ KHÓA LIÊN QUAN