Visual Basic® .NET Power Coding is the experienced developer's guide to mastering advanced Visual Basic .NET concepts. Paul Kimmel saves readers time and money by providing thorough explanations of essential topics so you can quickly begin creating robust programs that have fewer bugs. He also demonstrates important concepts by using numerous real-world examples that include working code that has been tested against Visual Basic .NET 2003.
After a brief review of language idioms, Kimmel moves to more advanced techniques that help programmers solve their most challenging problems. Central to advanced development and deployment are chapters on security, Web services, ASP.NET programming, COM Interop, and Remoting. This book also covers thin client programming, which offers businesses a real solution to managing deployment and upgrades with Windows Forms using Reflection and HTTP. An appendix walks readers through migrating Visual Basic 6.0 applications to Visual Basic .NET. A companion Web site includes the complete downloadable source code, extensive reusable examples, and updates from the author.
This book can be read cover-to-cover or used as a reference to answer questions faced by experienced VB .NET developers, including:
Visual Basic® .NET Power Coding empowers developers to exploit all the advanced features of Visual Basic .NET.
Download the Sample Chapter related to this title.
About the Authors.
I. POWER LANGUAGE ESSENTIALS.1. Basic Language Idioms.
II. BUILDING SOLUTIONS.7. COM Interop.
III. WEB PROGRAMMING.13. Creating Web Services.
IV. DEBUGGING AND ADMINISTRATION.17. Debugging .NET.
A journey of a thousand miles begins with a single step.
By the time you are reading this I will be well into my third year working with .NET. After looking at some of the books already written about .NET, I tried to figure out what you, the reader, would be interested in by the time you had some .NET under your belt. We planned a bit in conceiving and producing this book. Now that .NET has been out for a while, I feel many readers are ready for some chewy stuff on Visual Basic .NET (VB .NET).Who Should Read This Book
I wrote this book for professionals who have gotten past the basics and are ready for some torque. This book assumes you have read an introductory book on VB .NET, progressed through a more advanced book like Sams Visual Basic .NET Unleashed and are now ready to turn on the hyperdrive.
There is just a modicum of introductory material inside these pages. If you need to know how to write loops, conditional statements, functions, or subroutines, then set this book on your shelf and try something written at the introductory level until you're comfortable with that material. Then come back to this book.
If you're the kind of code slinger who has trophy projects on your shelf, then this is the book for you. Read on.What's in This Book
One chapter can be labeled a beginner's chapter, and that is Chapter 1. Chapters 2 through 18 contain advanced subject matter that will help you manage challenging problems whose solutions may be impossible to find in the help files and difficult to locate in other books.
Chapters 2 and 3 in this book cover subjects like inheritance and delegates because even seasoned Visual Basic 6 veterans might be a bit lost when it comes to these subjects. After all, neither inheritance nor delegates existed in VB6, and delegates are unique to .NET.
In Chapter 4 we will jump into the deep water with Reflection. If you have heard of Runtime Type Information (RTTI), then think of Reflection as RTTI on anabolic steroids. All of the things that can be done with Reflection haven't even been invented yet, but what has been invented and discovered is amazing.
For example, .NET code is converted to Intermediate Language (IL) code before it is JITted and run. .NET emulates the Java byte code model to a limited degree. VB .NET supports emitting new types at runtime directly into IL and then creating instances of those types on-the-fly. This book will show you how to emit IL using Reflection and provide you with a means of extending your code in the most fundamental ways after it is deployed.
"DLL hell" is vaporized in VB .NET by adding metadata to assemblies. For now think of an assembly as an application that carries extra information with it, eliminating the need to monkey around with the registry and Globally Unique Identifiers (GUIDs) so much.
Another cool technology is the ability to dynamically load assemblies over an HTTP wire. This means you can implement automatically deployable and updatable Windows applications emulating the thin client browser model.
Windows Forms-based applications provide a richer client experience than Web Forms-based applications, and thin client programming using assemblies may finally allow the convergence of Web and Windows development technologies.
This book will demonstrate how to use assembly metadata as well as how to implement thin client Windows applications that deploy over the Web and seamlessly update without user intervention.
There are times when you absolutely need multithreading capabilities. I will demonstrate how to use synchronous and asynchronous processes, thread pooling, and the thread class to safely incorporate multithreaded behavior and even how to do so with Windows Forms controls.
Multithreading in VB .NET is definitely a cruise missile you want in your arsenal. Read Chapter 6 to learn how to use threads safely and professionally.
A huge body of code exists in the COM world. Microsoft hasn't pulled the plug on COM, so why should you? Even Visual Studio .NET (VS .NET) uses COM; look at the Add-Ins Manager.
COM Interop allows you to use COM components in .NET and .NET code in COM-based applications. In Chapter 7 you will learn the ropes of COM Interop in VB .NET.
Moving toward open standards, Microsoft has developed new ways to solve existing problems. Remoting supports the management of solutions in a distributed environment. Read Chapter 8 to learn how to serialize objects and implement remoting for your distributed projects.
Historically, building advanced components for Visual Basic often required using ActiveX and a C++ compiler. VB .NET supports building professional components for VB .NET with VB .NET.
By working through Chapter 9 you will have an opportunity to build user controls, custom controls, and server controls. Several examples demonstrate the nuts and bolts of implementing and testing controls and adding those controls to VS .NET.
A sweeping change in .NET is found in ADO.NET technology. .NET follows the disconnected data model necessary for Web applications. The disconnected nature of ADO.NET is supported by XML DataSets, which replace the Recordset.
DataSets are based on XML and require you to rethink the way you build database, client-server, and Web-enabled applications. Chapters 11 and 12 in this book demonstrate how to use DataSets and work with disconnected data, as well as how to use XML and XSD schemas to connect to any kind of data anywhere.
One of the most exciting new technologies is Web Services. A Web Service represents code that can be called from anywhere in the world. Web Services use open standards protocols, like SOAP and XML, allowing any connected computer to request services from any other computer.
You will learn about XML, SOAP, Web Services, and UDDI as you read the pages of this book (especially Chapters 13 and 14). I will provide many examples and describe these technologies (and acronyms, like UDDI).
The world of exciting new innovations includes ASP.NET. The ASP.NET model facilitates building Web applications very similar to how you build Windows-based applications.
While writing this book I was also working on an enterprise solution using ASP.NET. Through that experience, I learned the best practices for implementing, debugging, and securing Web applications and included them in Chapters 15 and 16.
You will have an opportunity to learn about Web Forms and server controls, as well as managing state using caching and XML serialization, connecting Web applications to data, and using the Policy Manager and new security attributes in .NET.
After reading this book you will agree that there is much to VB .NET.Looking Ahead
I wrote this book to be readable from cover to cover, beginning with Chapter 1. I was also mindful that many readers are busy and may not have the time to read hundreds of pages in one sitting.
The many code listings will help you find examples to support the theoretical material presented; the chapters are organized to require only a modest amount of interdependency. If you are looking for answers to specific questions, you may be able to find all the material in one location.
I stand behind what I write, and I strive to offer the most accurate and informative content available. If you have any specific questions, feel free to e-mail me at firstname.lastname@example.org. Any feedback is appreciated.
Download the Index
file related to this title.