Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!:RAD, Baby
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
(Publisher: The Coriolis Group)
Author(s): Peter G. Aitken
ISBN: 1576102815
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
The Skeleton In Your Program
To use some official terminology, we can say that Visual Basic is an applications framework. It provides the bonesthe skeleton, if you willfor your applications. All the fundamental building blocks of a Windows program are included in Visual Basic, waiting for you to use them. No longer do you have to write dozens of lines of code to display a dialog box or an option button. (Yes, believe it or not, thats the way Windows programs used to be written.) The process is so simple that you are free to spend almost all your time and mental energy working on the important parts of your programthose elements that make it unique in the world of Windows programs.
The idea hereand I know Im repeating myself, but this is important, so listen upis that a lot of what goes on in any Windows program goes on in every Windows program. Each time you put a text box or a menu in a program, a thousand other programmers are doing the samefrom London to Sydney, from Bombay to Cherepovets. (Look it up. Hint: Its not in Silicon Valley.) The folks at Microsoft reasoned, Why should every programmer have to spend time writing the same code for the same program elements? Lets do all that basic stuff for them. Thus was born one of the fundamental ideas behind Visual Basic: the concept of an applications framework. Let the development toolthat is, Visual Basicdo all the boring, repetitive work and free the programmer to work on the creative aspects of the program. Which brings us to an essential rule: Dont reinvent the wheel.
Visual Basics job, then, is to provide a whole bunch of the wheels that your Windows programs need. The time you might have spent reinventing these wheels will be better spent creating meaningful, unique program features. I hope youll forgive the mixing of metaphorsone minute Visual Basic is a framework, the next its a skeleton, and now its wheelsbut this is a critical point. When youre creating a Visual Basic application that requires a certain feature or capability, the first question to ask is whether Visual Basic provides what you need. Visual Basic doesnt have everything, but you will be surprised to discover just how much it does have. These wheels are, of course, the components that I spoke about earlier.
A Framework Is Not Enough
The framework provided by Visual Basic is pretty darned amazing. Visual Basics framework is so complete, in fact, that you can create an impressive-looking program without writing a single line of code (or very few lines, at most). The program could have multiple windows, each containing an impressive array of option buttons, lists, text boxes, and so on. Menus would display when needed, dialog boxes would come and go, and everything would look terrific. Only one thing would be lacking, but its a very important thingthe program wouldnt do anything (other than look nice). The meaningful parts of the programthe parts that make it into a word processor, a stock market analyzer, or a multi-media presentationare missing. This is what you, the programmer, must add. To teach you how to do this is the main goal of this book. As youll see in this and subsequent chapters, the task is divided into two main parts:
Select those components from the Visual Basic framework that are best suited to your program.
Write Basic code to tie the framework components together and provide the needed functionality.
In the remainder of this chapter, well take a closer look at the different parts of Visual Basic. I know youre probably itching to sit down at your computer and get to work with Visual Basic, and I promise some hands-on work in the next chapter. But please try to stay with me for the next few pages; I think youll find this theoretical material to be a real help down the road.
Objects Is Objects
The framework that Visual Basic provides comes in the shape of components, or objects. Sometimes, youll see the term class used as well. This confusing terminology is unfortunate but theres not much to be done about it. Just remember, when you see component, object, or class, it refers to something that is reusable and independent and can be used in a program to perform some useful function.
Software components have been around for a long time, sometimes under another name. The complexity of Windows programming, however, and the continued development of sophisticated programming tools, such as Visual Basic, have made an increased reliance on software components not only possible, but necessary.
TIP: Is Visual Basic Object-Oriented Programming (OOP)?
In a word, sort of. Okay, I know thats two words, but its the best answer I can offer. With all the talk of objects in Visual Basic, you might well think that Visual Basic lets you do real OOP like C++ and Java. While Visual Basic lets you perform some programming tasks in a manner that is similar to OOP, it does not have all the characteristics of a true object-oriented language. For example, it lacks inheritance and polymorphism. The term object is used differently in Visual Basic. This does not mean that Visual Basic is inferior in some way; its just a different approach to programming (and for many purposes, a better one).
A software component is nothing more than a self-contained chunk of software that performs a specific task. The task can be just about anythingfrom the very simple, such as calculating a cube root, to the very complex, such as providing a spreadsheet-like grid in a window. The self-contained part of the definition is important. To reap the maximum benefits from a software component, you should be able to take it off the shelf (so to speak) and drop it directly into your program without any fuss. The more software components you have at your disposal, the easier your programming will be. Instead of writing, testing, debugging, and rewriting the code yourself, all you do is pop the component into your program. Remember the wheels I was talking about earlier in the chapter and our rule, Dont reinvent the wheel? Software components are those ready-made wheels.
You may be thinking that Visual Basics objects are software components, and you are 100-percent correct. This is one of the three levels of software components in Visual Basic. By themselves, they are powerful, but theres more.
On a second level, Visual Basic permits you to create your own software components. As you gain more programming experience, youll probably find yourself doing certain tasks over and over in different programs. This is particularly true if all your programming tends to fall in a specialized category, such as graphics or database. For example, many of your programs may need a dialog box that lets the user select from a palette of background patterns. Whatever the specifics, Visual Basic provides the tools that permit you to wrap the functionality in a self-contained component that you can then easily drop into future programs.
The third level at which Visual Basic uses software components is that of custom controls (also referred to as OCX and ActiveX controls). A custom control is not part of the Visual Basic package, but is provided by Microsoft or another vendor as an enhancement. When you install a custom control, it is available within Visual Basic just like the controls that come with Visual Basic. As you plan or work on a project, you should have some knowledge of the custom controls that are available. Some are free or available for minimal cost as shareware, while others are commercial products at various prices. Finding just the right custom control can often save you days or weeks of tedious programming and is usually well worth any associated cost.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.
Wyszukiwarka
Podobne podstrony:
t informatyk12[01] 02 1012010 01 02, str 067 07301 0201 02 Taikyoku Sono Ichi, NiTI 01 02 27 T pl(2)KOMINY 6 7 01 022010 01 02, str 054 057312[01] 02 122 Arkusz egzaminacyjnyIN1 01 022010 01 02, str 100 105Ujawniono kulisy wojny w Iraku Saddam przeczytał list i wyszedł (01 02 2009)STARTER 188 01 02 Instrukcja i SchematA17 Energia pola elektrycznego (01 02)TI 01 02 12 T pl(2)więcej podobnych podstron