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

visual basic 2005 for dummies oct 2005

385 317 0

Đ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 385
Dung lượng 9,26 MB

Nội dung

TEAM LinG Visual Basic ® 2005 FOR DUMmIES ‰ 01_57728x ffirs.qxd 10/3/05 6:31 PM Page i 01_57728x ffirs.qxd 10/3/05 6:31 PM Page ii by Bill Sempf Visual Basic ® 2005 FOR DUMmIES ‰ 01_57728x ffirs.qxd 10/3/05 6:31 PM Page iii Visual Basic ® 2005 For Dummies ® Published by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permit- ted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions. Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. Visual Basic and Visual Studio are registered trademarks of Microsoft Corporation. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REP- RESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CON- TENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CRE- ATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CON- TAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FUR- THER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFOR- MATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services, please contact our Customer Care Department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Control Number: 2005927630 ISBN-13: 978-0-7645-7728-4 ISBN-10: 0-7645-7728-X Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/SU/RQ/QV/IN 01_57728x ffirs.qxd 10/3/05 6:31 PM Page iv About the Author I am Bill Sempf, and you’ll notice that I don’t write in third person. I have spent an inordinate amount of time in the last several years writing about, thinking about, and coding in VB.NET. I am a coauthor of Pro Visual Studio.NET, Effective Visual Studio.NET, Professional ASP.NET Web Services and Professional VB.NET (among others), and a frequent contributor to the Microsoft Developer Network, Builder.com, Hardcore Web Services, Inside Web Development Journal, and Intranet Journal. I have recently been an invited speaker for DevEssentials, the International XML Web Services Expo, and the Association of Information Technology Professionals. As a graduate of Ohio State University with a Bachelor of Science in Business Administration, Microsoft Certified Professional, Certified Internet Business Strategist, and Certified Internet Webmaster, I have devel- oped over one hundred Web applications for startups and Fortune 500 companies alike. I began my career in 1985 by helping my father (also named Bill) manage Apple IIe systems for the local library. Since then, I have built applications for the likes of Lucent Technologies, Bank One, the State of Ohio, Nationwide Insurance, and Sears, Roebuck and Co. I specialized in data-driven Web applications of all types, both public and private. Currently, I am the Senior Technology Consultant at Products of Innovative New Technology in Grove City, Ohio, a Microsoft Certified Partner. I can be reached at bill@pointweb.net. 01_57728x ffirs.qxd 10/3/05 6:31 PM Page v 01_57728x ffirs.qxd 10/3/05 6:31 PM Page vi Dedication On August 6, 2005, my beautiful wife, Gabrielle, and my new son, Adam, col- laborated on a birthing project. You may have noticed that the publication date of this book puts the majority of the editing right smack dab in the middle of that project. Though it was a busy time, and a crazy few months, I couldn’t be happier. Gabrielle, I probably needn’t thank you again for putting up with the 5:00-AM editing during the 5:00-AM feeding, but I will anyway. Thank you. You are, as you know, the love of my life. Adam, hopefully some of this stuck while you were lying on my desk during the editing process. The world needs Visual Basic programmers as smart and handsome as you. I am so looking forward to watching you become a part of this world. Author’s Acknowledgments I cannot begin to thank the amazing team at Wiley who led me ever so care- fully through the process of developing this book. Katie Feltman was amazing in helping to solidify the ideas I wanted to present here in the early stages. She also handled the completion stages of the book with tremendous skill. Thank you. Beth Taylor did a great job editing the initial chapters, and then Leah Cameron, Jean Rogers, Barry Childs-Helton, and others stepped in to make sure what I had to say made sense. Did I mention Leah? She really made this all come together from the editing perspective. If you read a line and say, “Wow, I never heard it put so clearly!” that was probably Leah’s editing. Special thanks go to Jeff Simmons, who handled the majority of the technical editing, and Rich Hundhausen, who covered some of the earlier chapters. You wouldn’t believe the number of technical details that need to be checked in a book like this. My army of peer reviewers was fantastic: Theresa Alexander, Jim Andrews, David Deloveh, Rex Mahel, Greg McNamara, Rob Morgan, Blake Sparkes, and Gary Spencer. Here’s a special note about my father, William E. Sempf, whose education background was of inestimable help in reviewing the early concepts for the book. Then, he let me use him as a guinea pig for Part I! What a trouper! Finally, a shout to the many Microsoft people who gave me a hand with spe- cific questions about VB, Visual Studio, and the framework in general: Jan Shanahan and Susann Ragsdale in the Author Support Group, and Brad McCabe, Daniel Roth, Jay Roxe, and Steve Lasker, among many others, on the development teams. 01_57728x ffirs.qxd 10/3/05 6:31 PM Page vii Publisher’s Acknowledgments We’re proud of this book; please send us your comments through our online registration form located at www.dummies.com/register/. Some of the people who helped bring this book to market include the following: Acquisitions, Editorial, and Media Development Editors: Beth Taylor, Leah Cameron, Jean Rogers Acquisitions Editor: Katie Feltman Technical Editors: Jeff Simmons, Richard Hundhausen Editorial Manager: Leah Cameron Media Development Specialist: Laura Atkinson Media Development Manager: Laura VanWinkle Media Development Supervisor: Richard Graves Editorial Assistant: Amanda Foxworth Cartoons: Rich Tennant ( www.the5thwave.com) Composition Services Project Coordinator: Kathryn Shanks Layout and Graphics: Jonelle Burns, Andrea Dahl, Joyce Haughey, Stephanie D. Jumper, Barbara Moore, Barry Offringa Proofreaders: Leeann Harney, Jessica Kramer, Carl William Pierce, Dwight Ramsey, TECHBOOKS Production Services Indexer: TECHBOOKS Production Services Special Help Barry Childs-Helton Publishing and Editorial for Technology Dummies Richard Swadley, Vice President and Executive Group Publisher Andy Cummings, Vice President and Publisher Mary Bednarek, Executive Acquisitions Director Mary C. Corder, Editorial Director Publishing for Consumer Dummies Diane Graves Steele, Vice President and Publisher Joyce Pepple, Acquisitions Director Composition Services Gerry Fahey, Vice President of Production Services Debbie Stailey, Director of Composition Services 01_57728x ffirs.qxd 10/3/05 6:31 PM Page viii Contents at a Glance Introduction 1 Part I: Getting to Know .NET Using VB 9 Chapter 1: Wading into Visual Basic 11 Chapter 2: Using Visual Studio 2005 23 Chapter 3: Designing Applications in VB 2005 43 Part II: Building Applications with VB 2005 61 Chapter 4: Building Windows Applications 63 Chapter 5: Building Web Applications 83 Chapter 6: Building Class Libraries 109 Chapter 7: Building Web Services 125 Chapter 8: Debugging in VB 2005 141 Part III: Making Your Programs Work 157 Chapter 9: Interpreting Strings and Things 159 Chapter 10: Making Decisions in Code 177 Chapter 11: Getting Loopy 189 Chapter 12: Reusing Code 199 Chapter 13: Making Arguments, Earning Returns 221 Part IV: Digging into the Framework 237 Chapter 14: Writing Secure Code 239 Chapter 15: Accessing Data 253 Chapter 16: Working with the File System 271 Chapter 17: Accessing the Internet 283 Chapter 18: Creating Images 299 Part V: The Part of Tens 309 Chapter 19: Ten Tips for Using the VB User Interface 311 Chapter 20: Ten Ideas for Taking Your Next Programming Step 323 Chapter 21: Ten Resources on the Internet 335 Index 339 02_57728x ftoc.qxd 10/3/05 6:32 PM Page ix [...]... Debugging the Projects 150 Windows Forms 150 Web Forms 151 Class libraries 153 Web services 154 xiii xiv Visual Basic 2005 For Dummies Part III: Making Your Programs Work 157 Chapter 9: Interpreting Strings and Things 159 Types of Information in Visual Basic 160 Understanding types in Visual Basic 161 Changing types with CType... before you start writing the code Previous versions of Visual Basic were complete development environments The latest version of Visual Basic is really only one part of a three-part programming strategy: ߜ A language: For this book, it is Visual Basic 2005 Other popular languages include C#, J#, Perl, and 24 others ߜ An Integrated Development Environment (IDE): For this book, it is Visual Studio 2005. .. System.Drawing.Brushes.Blue How VB 2005 differs from VB 6 Visual Basic 6 was a standalone program, and Visual Basic 2005 is one language in a larger development system To go back to VB’s roots, Basic was a programming language used 20 years ago as part of MS-DOS In 1985, Basic became Visual Basic and was made into a part of the Windows application-building tool There’s a lot more to the Visual Basic 6 program than... of the Visual Basic pool and get comfortable with its place in the larger Visual Studio environment Then, you can really get your feet wet as you build Hello World — your first VB 2005 Windows Forms application — right here in the first few pages! You find out how to launch Visual Studio 2005 (the development tool for your VB applications), how to start a new project, and how to build a form visually... Wading into Visual Basic create a Windows Forms program using the Visual Basic language, just like the old days Or you might want to write an application for a smart device using C# ߜ Windows Forms: The new term for an old-fashioned Visual Basic application This term refers to an application that is written using the NET Framework and has a Windows user interface ߜ Web Forms: The term for an application... VBForDummies.net .336 GotDotNet.com 336 ASP.NET Web 336 The Microsoft Public Newsgroups 337 NET 247 337 Search IRC 337 kbAlertz 337 CodeSwap .338 Google for Code Snarfing 338 Index 339 xvii xviii Visual Basic 2005 For Dummies Introduction W elcome to the new version of Visual Basic for. .. is for information that is more in-depth than the rest of the book If you are following along with Visual Studio and don’t want to be distracted, skip over the Technical Stuff icons Foolish Assumptions I assume that, by buying this book and reading it, you are interested in finding out how to program in Visual Basic Beyond that, I also assume that you have the following: 3 4 Visual Basic 2005 For Dummies. .. .14 Setting up Visual Studio 14 Starting a Windows Forms project 15 Adding functionality to the form with VB code .17 Running and operating your Windows form 18 Finding More Power in Visual Studio 20 Visual Studio doesn’t just do Windows! 20 Visual Basic goes mobile 21 VB as your one-stop development shop 21 Chapter 2: Using Visual Studio 2005 ... the deeper power of Visual Basic Specifically, I introduce how VB 2005 integrates with the Microsoft NET Framework and offer insight into what that means to you as a programmer Visual Basic s Role in the Framework Microsoft created the NET Framework to make development for the various Windows operating systems easier But because of the differences between Visual Basic 6.0 and Visual Basic 7.0 (the first... the risk 242 xv xvi Visual Basic 2005 For Dummies Building Secure Windows Forms Applications 243 Authentication using Windows login 243 Encrypting information 245 Deployment security 246 Building Secure Web Forms Applications 247 SQL Injection attacks 247 Script exploits 248 Best practices for securing your Web Forms applications 250 Using . xvii Visual Basic 2005 For Dummies xviii 02_57728x ftoc.qxd 10/3/05 6:32 PM Page xviii Introduction W elcome to the new version of Visual Basic for 2005. As its name implies, Visual Basic is a visual. TEAM LinG Visual Basic ® 2005 FOR DUMmIES ‰ 01_57728x ffirs.qxd 10/3/05 6:31 PM Page i 01_57728x ffirs.qxd 10/3/05 6:31 PM Page ii by Bill Sempf Visual Basic ® 2005 FOR DUMmIES ‰ 01_57728x. into Visual Basic . . . . . . . . . . . . . . . . . . . . . . . . . . .11 Visual Basic s Role in the Framework 11 Saying Hello to VB 2005! 14 Setting up Visual Studio 14 Starting a Windows Forms

Ngày đăng: 25/03/2014, 16:07

TỪ KHÓA LIÊN QUAN