Beginning Visual Basic 2010
eBook - ePub

Beginning Visual Basic 2010

  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

Beginning Visual Basic 2010

About this book

Visual Basic 2010 offers a great deal of functionality in both tools and language. No one book could ever cover Visual Basic 2010 in its entirety—you would need a library of books. What this book aims to do is to get you started as quickly and easily as possible. It shows you the roadmap, so to speak, of what there is and where to go. Once we've taught you the basics of creating working applications (creating the windows and controls, how your code should handle unexpected events, what object-oriented programming is, how to use it in your applications, and so on) we'll show you some of the areas you might want to try your hand at next.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Beginning Visual Basic 2010 by Thearon Willis,Bryan Newsome in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Languages. We have over one million books available in our catalogue for you to explore.

Information

Chapter 1
Welcome to Visual Basic 2010
What You Will Learn in this Chapter
  • Using event-driven programming
  • Installing Visual Basic 2010
  • A tour of the Visual Basic 2010 integrated development environment (IDE)
  • Creating a simple Windows program
  • Using the integrated Help system
This is an exciting time to enter the world of programming with Visual Basic 2010 and Windows 7. Windows 7 represents the latest Windows operating system from Microsoft and is packed with a lot of new features to make Windows programming fun. Much has changed in the Windows user interface, and Visual Basic 2010 makes it easy to write professional-looking Windows applications as well as web applications and web services. Haven't upgraded to Windows 7 yet? No worries, Visual Basic 2010 also enables you to write professional-looking applications for previous versions of Windows as well.
The goal of this book is to help you use the Visual Basic 2010 programming language, even if you have never programmed before. You will start slowly and build on what you have learned in subsequent chapters. So take a deep breath, let it out slowly, and tell yourself you can do this. No sweat! No kidding!
Programming a computer is a lot like teaching a child to tie his shoes. Until you find the correct way of giving the instructions, not much is accomplished. Visual Basic 2010 is a language you can use to tell your computer how to do things; but, like a child, the computer will understand only if you explain things very clearly. If you have never programmed before, this sounds like an arduous task, and sometimes it can be. However, Visual Basic 2010 offers an easy-to-use language to explain some complex tasks. Although it never hurts to have an understanding of what is happening at the lowest levels, Visual Basic 2010 frees the programmer from having to deal with the mundane complexities of writing Windows applications. You are free to concentrate on solving real problems.
Visual Basic 2010 helps you create solutions that run on the Microsoft Windows operating systems, such as Windows 7, Windows Server 2008, and Windows Mobile 6.1. If you are looking at this book, you might have already felt the need or desire to create such programs. Even if you have never written a computer program before, as you progress through the Try It Out exercises in this book, you will become familiar with the various aspects of the Visual Basic 2010 language, as well as its foundations in the Microsoft .NET Framework. You will find that it is not nearly as difficult as you imagined. Before you know it, you will feel quite comfortable creating a variety of different types of programs with Visual Basic 2010.
Visual Basic 2010 can also be used to create web applications and web services, as well as mobile applications that can run on Pocket PCs or smartphones. However, you will begin by focusing on Windows applications before extending your boundaries to other platforms.

Event-Driven Programming

A Windows program is quite different from yesteryear's MS-DOS program. A DOS program follows a relatively strict path from beginning to end. Although this does not necessarily limit the functionality of the program, it does limit the road the user has to take to get to it. A DOS program is like walking down a hallway; to get to the end you have to walk down the entire hallway, passing any obstacles that you may encounter. A DOS program would only let you open certain doors along your stroll.
Windows, on the other hand, opened up the world of event-driven programming. Events in this context include clicking a button, resizing a window, or changing an entry in a text box. The code that you write responds to these events. In terms of the hallway analogy: In a Windows program, to get to the end of the hall you just click the end of the hall. The hallway itself can be ignored. If you get to the end and realize that is not where you wanted to be, you can just set off for the new destination without returning to your starting point. The program reacts to your movements and takes the necessary actions to complete your desired tasks.
Another big advantage in a Windows program is the abstraction of the hardware, which means that Windows takes care of communicating with the hardware for you. You do not need to know the inner workings of every laser printer on the market just to create output. You do not need to study the schematics for graphics cards to write your own game. Windows wraps up this functionality by providing generic routines that communicate with the drivers written by hardware manufacturers. This is probably the main reason why Windows has been so successful. The generic routines are referred to as the Windows application programming interface (API), and most of the classes in the .NET Framework take care of communicating with those APIs.
Before Visual Basic 1.0 was introduced to the world in 1991, developers had to be well versed in C and C++ programming, as well as the building blocks of the Windows system itself, the Windows API. This complexity meant that only dedicated and properly trained individuals were capable of turning out software that could run on Windows. Visual Basic changed all of that, and it has been estimated that there are now as many lines of production code written in Visual Basic as in any other language.
Visual Basic changed the face of Windows programming by removing the complex burden of writing code for the user interface (UI). By allowing programmers to draw their own UI, it freed them to concentrate on the business problems they were trying to solve. When the UI is drawn, the programmer can then add the code to react to events.
Visual Basic has also been extensible from the very beginning. Third-party vendors quickly saw the market for reusable modules to aid developers. These modules, or controls, were originally referred to as VBXs (named after their file extension). Prior to Visual Basic 5.0, if you did not like the way a button behaved, you could either buy or create your own, but those controls had to be written in C or C++. Database access utilities were some of the first controls available. Version 5 of Visual Basic introduced the concept of ActiveX, which enabled developers to create their own ActiveX controls.
When Microsoft introduced Visual Basic 3.0, the programming world changed significantly. Now you could build database applications directly accessible to users (so-called front-end applications) completely with Visual Basic. There was no need to rely on third-party controls. Microsoft accomplished this task with the introduction of Data Access Objects (DAOs), which enabled programmers to manipulate data with the same ease as manipulating the user interface.
Versions 4.0 and 5.0 extended the capabilities of Version 3.0 to enable developers to target the new Windows 95 platform. They also made it easier for developers to write code, which could then be manipulated to make it usable to other language developers. Version 6.0 provided a new way to access databases with the integration of ActiveX Data Objects (ADOs). The ADO feature was developed by Microsoft to aid web developers using Active Server Pages (ASP) to access databases. All of the improvements to Visual Basic over the years have ensured its dominant place in the programming world—it helps developers write robust and maintainable applications in record time.
With the release of Visual Basic .NET in February 2002, most of the restrictions that used to exist were obliterated. In the past, Visual Basic was criticized and maligned as a “toy” language, because it did not provide all of the features of more sophisticated languages such as C++ and Java. Microsoft removed these restrictions with Visual Basic .NET, which was rapidly adopted as a very powerful development tool. This trend has continued with the release of Visual Basic 2003, Visual Basic 2005, Visual Basic 2008, and the latest release, Visual Basic 2010. Each new release of the Visual Basic .NET programming language offers many new features, improveme...

Table of contents

  1. Cover
  2. Title Page
  3. Copyright
  4. Dedication
  5. About the Authors
  6. About the Technical Editor
  7. Credits
  8. Acknowledgments
  9. Introduction
  10. Chapter 1: Welcome to Visual Basic 2010
  11. Chapter 2: The Microsoft .NET Framework
  12. Chapter 3: Writing Software
  13. Chapter 4: Controlling the Flow
  14. Chapter 5: Working with Data Structures
  15. Chapter 6: Extensible Application Markup Language (XAML)
  16. Chapter 7: Building Windows Applications
  17. Chapter 8: Displaying Dialog Boxes
  18. Chapter 9: Creating Menus
  19. Chapter 10: Debugging and Error Handling
  20. Chapter 11: Building Objects
  21. Chapter 12: Advanced Object-Oriented Techniques
  22. Chapter 13: Building Class Libraries
  23. Chapter 14: Creating Windows Forms User Controls
  24. Chapter 15: Accessing Databases
  25. Chapter 16: Database Programming with SQL Server and ADO.NET
  26. Chapter 17: Dynamic Data Web Site
  27. Chapter 18: ASP.NET
  28. Chapter 19: Visual Basic 2010 and XML
  29. Chapter 20: Deploying Your Application
  30. Appendix A: Exercise Solutions
  31. Appendix B: Where to Now?
  32. Index
  33. Advertisement