View Sidebar

A Million Little Pieces Of My Mind

Application Design in Visual Basic 6.0

By: Paul S. Cilwa Viewed: 4/23/2024
Page Views: 485
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
A free online course in programming Visual Basic 6.0.

I taught Visual Basic programming for a living. Many times, I have been hired to teach "Introduction to Visual Basic" to students who have already taken a course by that name. Why? Because too many of the Visual Basic courses out there teach students how to "use" the Visual Basic development environment, not how to actually write Windows applications in Visual Basic!

There is a world of difference between the two. In the first case, students spend a day or two or three writing, in effect, calculator programs. Now, that's quite an accomplishment—if you happen to need a calculator—however, Windows already comes with one. Consider all that goes into a far more complicated application, one that is considered a simple one: Notepad.

When you open Notepad, it creates an initial, blank "document" for you. If you click the File..Save menu command, it behaves like the File..Save As command: it brings up the standard File Open dialog box, since your document has not yet received an actual file name. However, once you have saved a document, from then on File..Save does do a quiet save, because it knows the name of the file. File..Save As still brings up the File Open dialog, even when the document has a file name assigned to it.

In other words, File..Save sometimes behaves like File..Save As before storing the data on the hard disk; and File..Save As has to do the same job as File..Save, once the file has a name.

This is actually a fairly complex bit of behavior; and, remember, nearly every Windows application features it. How can you implement this in Visual Basic? Those three-day classes can't tell you.

Here's another example: Run any MDI (multiple document interface) application, such as Microsoft Word. Note that, after opening a document, you can use the Window..New command to create a duplicate window into the same document you were previously viewing. You can then arrange the two windows so both are visible at once. Now, type into one of them. Changes you make are instantly reflected in the other window…and this would be true even if you had a dozen, or a hundred, additional windows. This interplay of components could be quite daunting to implement if you didn't know how…and those three-day classes don't begin to cover anything like this. Yet, any MDI application you write must include this feature, or it isn't truly an MDI-compliant application.

That's why my Visual Basic classes are given in five days. That gives us enough time to learn, not only Visual Basic syntax and how to use the development environment, but also how to write a real Visual Basic application.

But, there's only one of me, and I won't live long enough to teach everyone in the world in person. Therefore, I am making my Visual Basic knowledge available via this Web site; I will add to it as time permits, and, hopefully, it will be of assistance to those who need to write real Windows applications, and not just calculators.

Lessons

The modules listed below, through "Objects", cover the pre-requisites for my Accelerated Visual Basic course.

Working with CPUs

By: Paul S. Cilwa Page Views: 678
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Preliminary material for this free online course in Visual Basic 6.0.

The first step in writing a successful computer program is to decide what you actually want to accomplish. That is not the same as deciding what you want the computer to do! Look at this subtle difference: If you are designing a home stereo system, the end goal is not for the system to play music; it is for the system's owner to enjoy music played by the system. Too complex a user interface to the system may, for many users, get in the way of that goal.

Read more…

A Little Visual Basic History

By: Paul S. Cilwa Page Views: 897
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Optional preliminary material for this free online course in Visual Basic 6.0.

The BASIC language was invented in 1964 by graduate students at Dartmouth College in Vermont. This was a long time ago. It was a different world, then.

Read more…

Working with the IDE

By: Paul S. Cilwa Page Views: 698
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 1 of this free online course in Visual Basic 6.0.

Not that many years, programmers had to also be jugglers. In addition to the obvious—juggling job schedules, project schedules, personal schedules, and softball practice, programmers also had to manage all the files that made up their projects, and the compiled versions of those files, and work out dependency lists that made sure all the components that needed to be re-compiled after each code change, were re-compiled—but that others weren't, because that would take too much time. We also had to keep track of code editors, resource editors, resource painters, compilers, linkers, librarian systems, and more.

Read more…

Working with Projects

By: Paul S. Cilwa Page Views: 706
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 2 of this free online course in Visual Basic 6.0.

A project is defined as all the modules and supporting files that contribute to the finished program, including one file that ties all the other pieces together. That file is called the project file.

Read more…

Working with Modules

By: Paul S. Cilwa Page Views: 682
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 3 of this free online course in Visual Basic 6.0.

If you have been programming in the "linear" (non-object-oriented) fashion for years, you may wonder—perhaps with some trepidation—how big a change object-oriented programming will bring. To ease your concerns, let's look at the linear code modules that can contribute to some Visual Basic programs. Also remember that, each of your object-oriented components will be built up of linear snippets! So, on a line-by-line basis, object-oriented programming isn't so different from linear programming, after all.

Read more…

Working with Forms

By: Paul S. Cilwa Page Views: 695
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 4 of this free online course in Visual Basic 6.0.

Forms are the primary unit of construction of a Visual Basic application. A form is a platform upon which user interface interactions are based. They provide a base on which controls such as buttons and list boxes can be placed, which the user manipulates directly.

Read more…

Working with Colors and Graphics

By: Paul S. Cilwa Page Views: 684
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 5 of this free online course in Visual Basic 6.0.

In Windows, colors are represented (as is everything else) by numbers—specifically, 24-bit numbers. The 24 bits are divided into three sets of 8 bit values, one each for red, green, and blue intensities. As it turns out, virtually any color can be represented as combinations of red, green and blue.

Read more…

Working with Controls

By: Paul S. Cilwa Page Views: 671
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 6 of this free online course in Visual Basic 6.0.

Among the toolbars and dockable views that usually appear when you start up Visual Basic, one is called the Toolbox. This toolbar contains buttons for each kind of control you can place on a form. It comes with a set of standard items, but you can add more controls to the list.

Read more…

Working with Events

By: Paul S. Cilwa Page Views: 698
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 7 of this free online course in Visual Basic 6.0.

In the old days of linear programming, if data was changed it had no way of reporting that fact. Other parts of the program had to poll the data, repeatedly checking it to see whether it had changed—a very inefficient technique. Nowadays, with object-oriented programming, objects can report to their owners any condition they deem interesting. Such a report is called an event, and the code that reacts to that event is an event handler.

Read more…

Working with Objects

By: Paul S. Cilwa Page Views: 740
Topics: #VisualBasic6.0 #ProgrammingforMicrosoftWindows
Chapter 8 of this free online course in Visual Basic 6.0.

In the old days of linear programming. It was necessary to express all program components in terms of letters and numbers. If you were writing a game, and among the components of the game was a schooner and a treasure chest, this schooner would have to be described in terms of letters and numbers, and the treasure chest would have to be designed in terms of letters and numbers.

Read more…