My first book was about Visual Basic 3, and I later updated it for two other product versions, VB 4 and VB 6. Here’s a look back at those early days.
Note: This is one of a series of looking-back posts timed to the 20th anniversary of Visual Studio. So far, a few other similar articles are available, including The Faces Behind Microsoft Visual Studio and 20 Years of Visual Studio: Visual InterDev 1.0.
In 1994, I was asked by Gary Brent, a professor at Scottsdale Community College, if I’d like to help with the technical editing of a book about Visual Basic for the educational market. I accepted immediately, and was excited to help, of course.
Gary is, to this day, one of the smartest people I’ve ever known, but more important, perhaps, he was also the person who taught me software development, via classes I had taken previously about the C and C++ programming languages. In asking me to help out with what would become the awkwardly-titled Microsoft Visual Basic 3 Projects for Windows, he also began my career as a writer.
That this would happen wasn’t obvious at first, my assistance on that first book quickly evolved into perhaps writing a bit here and there, to writing entire chapters, and then a fuller collaboration with both him and the book’s other co-author, Jim Elam, another SCC professors. (The book was based on handout that Jim and Gary had created for students because they couldn’t find an acceptable book for teaching VB.)
Gary’s influence on my life is profound and still felt, and I credit him for giving me a firm grounding in both the technical side and in writing. Writers such as Jerry Pournelle and Woody Leonard had taught me earlier than technical writing didn’t have to be dry and boring, could in fact be entertaining and even enthralling. But Gary taught me, again and again, that it should always be correct. We went on to collaborate on many more books, many about very technical topics, including the Delphi 3 Super Bible that documented Borland’s VCL (Visual Component Library) at a time when even Borland wasn’t doing so, at least not correctly.
By the beginning of 1995, I was temporarily living in north-central Phoenix with my wife in a sub-let apartment and, in the time off from school, was feverishly writing Visual Basic 3 Projects for Windows. I spent entire days there doing nothing but writing the text, and it flowed out in some crazy explosion, while I listened to The Offsprings’ CD Smash over and over again, on repeat, on the CD player.
(That time is otherwise a blur, but in April we moved to an apartment in south-central Phoenix that was, not coincidentally right around the corner from Gary’s home. We spent the next three years or so collaborating, mostly in person, writing together as a team in his home office. There were many nights where I’d come home as the sun came up, and pass my wife who was then heading out to work. It was a schedule that couldn’t last, but we maintained it for quite a while.)
Visual Basic 3 Projects for Windows was a big deal for me for obvious reasons: It was my first book, after all, and my only real goal was to actually see a book with my name on it. But over time, things changed, and I’m still confused that I was able to make this transition so quickly: I went from a minor player on that book to a full co-author and then to the lead author. I eventually wrote most of that book myself. (Jim and Gary had previously worked up the handout on which the book was based, of course, and Gary worked with me extensively on the book. I needed a lot of help at that point, obviously, on both the code and the writing. Suffice to say that I could have never done this on my own.)
Finally, I took the brave and awkward step of asking to be listed as the primary author on the book. Again, I’m still amazed I did this. Likewise, I am still amazed that Gary (and Jim) agreed.
So, Visual Basic. How does one explain Visual Basic?
Put simply, Visual Basic was a joke.
That said, Visual Basic was also amazing, an innovative and forward-leaning programming environment that was both truly visual and approachable by beginners. The programming paradigm it introduced is still being used today in modern developer environments like Visual Studio, Apple XCode, and Android Studio.
But VB was a joke because the language itself was syntactically inconsistent and unpredictable. (A few years later, Gary and I co-taught a VB class at SCC and we eventually found numerous examples of code blocks that would not do what any logical person would believe they should do. It became sort of a game of uncovering the terribleness of VB.) That changed with the shift to .NET, somewhat. But classic VB (through version 6) was a mess.
That first book was, as noted about Visual Basic 3, which shipped in 1993 and ran on Windows 3.1. I was no fan of Windows at that time, but the sophistication of Microsoft Office and the Microsoft developer tools was obvious, and Windows 95 eventually won me over.
Gary and I updated the book for Visual Basic 4 in the even more awkwardly-named Visual Basic 4 Projects for Windows 95 in 1997.
And after I moved back to Boston, I updated it by myself for Projects for Microsoft Visual Basic 6. I’m not sure why anymore, since most of the book is updated from the previous editions, but that one only has my name on it. I did write a unique chapter about database programming, and there are four chapters in which the student creates and then improves a web browser. (Why we/I skipped Visual Basic 5 is unclear, but it may be related to my move, which happened under the cloud of a terrible health crisis.)
Looking at these books today, I see the same cringe-worthy introductory text in each, for the most part. I try to remind myself that the audience was high school- and college-level students, and that in 1994-1995, especially, we couldn’t assume any familiarity with computers at all. Those early books actually had an upfront section (which Gary and I supplied) about using and understanding Windows, with such weighty topic as manipulating a mouse.
So here is the introductory text from Projects for Microsoft Visual Basic 6, since this matches up most closely to the early days of Visual Studio. (You may recall that Visual Studio 97 included VB5, and that VB6 was part of Visual Studio 6.0, the second release.) This is the initial rough draft, as I sent it in Word format to the publisher, and looking over the actual printed book, I can easily spot many later changes. Fixing of them would be a lot of work, but I think this text, as is, provides a nice flavor of the day and time in which it was written.
Note: Sadly, I’ve not been able to find any of the original screenshot files.
When the first personal computers burst on the scene some 25 years ago, they were lumbering, unfriendly beasts designed for the die-hard technical users looking for something more than ham radios and electronic breadboard kits. Today, the Personal Computer (PC) is ubiquitous, in more homes than VCRs, and the idea of a standalone computer that is not connected to the global Internet is becoming ever rarer. We live in a truly connected society, and though this day was predicted in numerous science fiction stories of the past, no one really believed it would happen this quickly.
And even though this power has been available for only a short time, many computer users have a hard time remembering the days before the Internet opened the doors to vast realms of information sharing, gaming, and correspondence. Today, it is a trivial matter to converse with a friend on the far side of the planet, at any time, without even picking up a telephone. Web browsers connect us to distant sites on the Internet, with the same ease we encounter when opening a file on our own computer.
Have you ever wondered how this all works? Though you are a user of the software that makes your computer and even the Internet hum, have you ever thought about how it all comes together? Someone using Visual Basic (VB) or a tool like it created all of the computer software you’ve used, whether it runs natively on your Windows PC or remotely over the Internet. In this module, you will learn to create your own software, some of which will actually connect to distant sites over the Internet. As a user of Visual Basic, you are in an enviable position: Just a few short years ago, Internet programming required extensive knowledge of arcane codes and languages. Today, with the latest version of Visual Basic, it’s fun and easy, and creating your own Windows programs–those that don’t require any Internet connectivity at all–is even easier.
You’ve got the tools and this module will get you started. It’s time to create some magic of your own.
Programming the Computer
At its most basic level, a computer program is a series of codes that instructs the computer to perform certain tasks. When the computer follows these instructions, it is said to execute or run the program. Computers are capable only of executing programs that were written in its native machine language, a generally nasty collection of 1’s and 0’s that is unintelligible to most humans. Programmers, who use a programming language that is much easier to understand than machine language, write the programs you typically run, such as Microsoft Windows and Microsoft Office. There are numerous programming languages available, but they all have one thing in common: In the end, they translate the code of the programming language into the machine language the computer understands. This allows programmers to use a more friendly language when they write computer programs.
When it comes to programming languages, programmers are a religious bunch, generally sticking with—and defending—their language of choice. One of the first programming languages ever created, Fortran, was an early attempt at creating a programming language that could be easily read by humans. Later languages, such as Pascal, C, C++, and Java, gave up readability in an effort to enable more powerful features. Of the numerous programming languages that are available, only Visual Basic combines the ease-of-use of an easily read and understood language with the most advanced programming features currently available.
Tip Microsoft makes many programming language products for its Windows family of operating systems. You may have seen its Visual C++ (for C and C++ programming) and Visual J++ (for Java programming) products. These products are often used in tandem with Visual Basic in large programming projects, so they are also sold together in a package called Visual Studio. The current version of Visual Studio is 6.0.
A Short History of BASIC
After the creation of Fortran, an attempt was made in the 1960’s to create another, more readable computer language that normal people could use. Dubbed BASIC (Basic All-Purpose Symbolic Instruction Code) by its creators, this new language was an instant success with programmers because of its simple, English-like syntax. Versions of BASIC were created for virtually every kind of computer ever made and most up-and-coming programmers of the 1970’s began their careers by learning the language.
In the late 1970’s, the personal computer revolution began when a tiny company from Albuquerque, New Mexico named MITS introduced the Altair computer. Microsoft’s first product was a version of BASIC for the Altair, which was co-written by CEO Bill Gates, then only a teenager. Over the years, Microsoft ported BASIC to numerous personal computer systems and released a series of upgrades for the IBM PC such as GW-BASIC, QBasic, and QuickBasic. All of these BASIC derivatives ran on MS-DOS, the command line operating system that Microsoft had developed for IBM and the vast array of IBM-compatible PCs.
When Windows, a graphical successor to MS-DOS, became successful, Microsoft created the first version of Visual Basic. At the time, Windows programs were incredibly hard to create, and programmers struggled with the arcane C programming language and a bewildering collection of new concepts to learn. Visual Basic was designed to take the complexity out of Windows programming and make the process genuinely fun: It was an instant success. Indeed, the product was so successful, that many of its users weren’t even programmers.
The initial release of Visual Basic was quickly followed by several major updates, including version 3.0 (1993), 4.0 (1995), 5.0 (1997), and now, version 6.0. Each version has added to the power of the product while retaining its famous ease-of-use. Visual Basic 4.0 was the first version to support 32-bit Windows programming, introducing its users to the capabilities of Windows 95 and Windows NT. Early versions of Visual Basic used a confusing Single Document Interface (SDI) with multiple floating windows (Figure O.1), but Microsoft did away with this in version 5.0 (though it’s still an option for the old-school diehards).
Introduction to Visual Basic
Now that you’ve got a grasp on where Visual Basic came from, let’s take a look at the actual product and explore some of the thinking behind the Visual Basic “way.” Visual Basic is, quite simply, the easiest, fastest, and yes, most fun way to create programs for Windows 95, 98, and NT. In fact, Visual Basic is so popular that many other programming languages have tried to copy the VB “look and feel.” Tools like Visual Basic are now referred to as RAD (Rapid Application Development) because they make it so easy to create application programs. Still, Visual Basic is by far the easiest and the fastest of these solutions.
Even the word “visual” in Visual Basic is telling: The biggest change that Visual Basic brought to programming was the idea that the elements of a Windows application–the windows, buttons, menus, and other controls–could be manipulated visually and then simply tied together with code. In fact, for most applications, you essentially draw the application with a collection of window elements in a virtual toolbox, and then connect it all together with VB code. Compare this to the old method of programming where the weary programmer would sit at a text terminal typing endless lines of essentially unreadable C code and you’ll see why VB is so popular.
The essential Visual Basic concept–and it’s a concept that eventually found its way to all kinds of other programming methodologies, including Web development—is called event-driven programming. With the event-driven programming model used by Visual Basic, everything in your application is an object. These objects have properties, or attributes, that determine how objects look and act. A command button object, for example, has height and width properties.
These objects can handle events, which are, as you might suspect, things that happen to objects. The command button object we discussed earlier can handle an OnClick event, for example, that occurs when the user clicks the button. Different objects can handle different events, just as different objects have different properties. When you create a Visual Basic program, then, you visually arrange objects on a window (that VB refers to as a form) and decide which events you want to handle. It’s that simple.
Objects also support something called methods, which describe capabilities of the object. A method is basically something the object does. For example, you might have an object that accesses a database. One thing this object could do is connect to the physical database file somewhere on the computer or over a network, so the database object might have a Connect method that would make that happen. We will be looking into objects and their properties, events, and methods as we progress through the module.
Tip Objects can be compared to nouns, while properties are like adjectives and methods are like verbs. For example, a dog is an object that has properties such as size and color. And the dog can perform actions such as bark and run that can be compared to an object’s methods.
Visual Basic Editions
One thing that you may find confusing is the various editions of Visual Basic that are available. Microsoft packages VB three separate ways, and each edition is designed to appeal to a specific audience. This module will work with any of these editions, with the exception of Project 8, which requires a database library not found in the low-end, or base edition. Your instructor will have instructions for obtaining this library if needed.
- Control Creation Edition Though this hasn’t been updated since Visual Basic 5.0, the VB Control Creation Edition (CCE) is still a viable way to use Visual Basic to create ActiveX controls that run in Web browsers on the Internet. The VB 5.0 CCE is included on the CD-ROM that accompanies this text.
- Learning Edition Geared toward beginners, the Learning Edition includes some nice printed documentation (programmer-speak for “a book”), lots of online documentation (“a CD-ROM”) and a special “Learn VB Now” CD-ROM. This is a great package for anyone learning Visual Basic for the first time.
- Working Model Edition Also included on the enclosed CD-ROM, it offers the same development environment as the Learning Edition, though it doesn’t allow you to create executable files, Web pages, or ActiveX controls. These are minor limitations in learning Visual Basic, given the amount of tools you’re getting at such a low cost. To access the help files, you will need to register online with the MSDN Library at msdn.microsoft.com/developer/.
- Professional Edition This mid-level edition of Visual Basic includes all of the features in the Learning Edition plus additional controls, an integrated database and Web development tools.
- Enterprise Edition Designed with distributed application development in mind, the Enterprise Edition is for the most adept Visual Basic programmers. It supports a list of technologies too long and complicated to mention here. Suffice to say, this package is as complete as can be.
Additionally, Visual Basic is also available as part of an expensive—and huge—package called Visual Studio. Visual Studio includes all of Microsoft’s software and Web development tools in one box. It is designed for professional programmers that require multiple programming languages.
Visual Basic derivatives
In addition to Visual Basic itself, Microsoft has created a family of products that are based on Visual Basic. Each of the products fills a specific niche, and together with VB itself, they form the culmination of Bill Gates’ promise of “Visual Basic everywhere.” The idea is that learning Visual Basic isn’t the end, but rather the start of a journey: Once you’ve learned one of these derivatives, it’s easy to use any of the others.
- Visual Basic Scripting Edition (VBScript) This lightweight scripting language, which is used to provide interactivity in Web pages, brings the power of the Visual Basic language (but not the visual design tools) to HTML, the language of the Web. VBScript code can be embedded in the HTML code to create Web pages and provide features that normal HTML is incapable of.
- Visual Basic Applications Edition (VBA) Typically used as a macro language for application programs such as Microsoft Word and Microsoft Excel, VBA allows you to use the Visual Basic language (and a visual environment very similar to VB itself) to modify and enhance other programs. Applications that use VBA are extensively—and easily—programmable, giving users the power to hand-craft their own modifications.
- Windows CE Toolkit for Visual Basic. This package allows you to create applications for Windows CE, a new version of Windows designed for handheld and palm-sized PCs, using Visual Basic.
What’s new in Visual Basic 6.0
With each new release of Visual Basic, Microsoft has targeted the product at specific enhancements and features and version 6.0 is no different. Released in September 1998, Visual Basic 6.0 is designed to make Web and database programming easier than ever. On that note, the product is quite successful, but VB 6.0 includes much, much more than that. In keeping with VB’s ease-of-use, Microsoft has added numerous new Wizards—like the ones you might have seen in Microsoft Office—that guide you, step-by-step through specific tasks. New Windows 98 controls, such as Internet Explorer “coolbars,” have been added, and existing controls have been enhanced to take advantage of new features. These additions, along with the aforementioned Web and database enhancements, plus a long list of language improvements, makes Visual Basic 6.0 an important release.
Tagged with Visual Studio