Home > Store > Programming > Visual Basic

Introduction to Computer Programming with Visual Basic 6

Register your product to gain access to bonus material or receive a coupon.

Introduction to Computer Programming with Visual Basic 6

Book

  • Your Price: $115.09
  • List Price: $135.40
  • Available on demand.

Description

  • Copyright 1999
  • Dimensions: 8 X 10
  • Pages: 928
  • Edition: 1st
  • Book
  • ISBN-10: 1-58076-241-7
  • ISBN-13: 978-1-58076-241-0

Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach is written for students with little or no programming experience. This comprehensive text equips students with the skills necessary to develop computer applications in any language by helping them develop a framework for creating programs. Each chapter illustrates the application of this framework from Step 1 (Analysis) to Step 6 (Completing the Documentation) through a programming case study. The authors emphasize the program development life cycle and fundamental programming concepts such as data types, loops, decisions, and arrays.

FEATURES

  • To further highlight the authors' emphasis on programming concepts instead of GUI elements, a limited number of program controls are used in the examples. To provide greater flexibility to instructors, more GUI elements are included in Appendix A, "Visual Basic User Interface Objects." The preface and the Instructor's Resource Manual provide teaching tips on how to incorporate the controls presented in Appendix A in lab exercises or projects
  • Object-Event Diagrams are introduced in Chapter 1 to help students understand the importance of events
  • Two chapters on database programming (Chapter 10 and 11) offer students the skills needed to develop more robust database applications
  • Chapter 12 is devoted to fundamental object-oriented programming concepts and techniques for developing object-oriented programs in Visual Basic to reinforce this new standard for developing software
  • The authors offer outstanding pedagogical aids such as common examples that build on previous concepts, a multitude of end-of-chapter short answer and programming exercises, and plenty of programming projects

Sample Content

Preface

PREFACE

To the Student

Welcome to the exciting and challenging world of programming! With new software development environments such as Visual Basic, you can create attractive, sophisticated Windows programs in a short time. Remember, however, that the look of the program is only a small part of the total package. For the program to be useful, it must do something. That is the point of programming—developing the logic for the program to make it do something useful. Because Visual Basic is event driven, it is also important to think about when something should happen, such as when the user clicks a button or types a value. This book teaches you basic programming concepts that include problem analysis, interface development, logic organization and design, and program development and testing. Learning the entire thought process behind writing programs will equip you with a solid foundation in programming. This foundation will prepare you to learn other computer languages or more advanced features of Visual Basic on your own.

To the Teacher

Computers continue to make amazing progress in speed and capabilities. Ideally, we as teachers want our students to use state-of-the-art software as they learn fundamental programming concepts. Visual Basic is a popular application development tool with useful features for designing professional-looking screens and coding and testing programs. With this tool, the programmer has easy access to all the buttons, boxes, pictures, and menus that you commonly see in shrink-wrapped software today. Although it is fun to try using each of these objects in a program, the students can learn much of this on their own after understanding basic concepts about adding an object to a form, setting its properties, and using its methods and events in code. The continuing challenge is to develop logical thinking skills to be able to translate a problem description into appropriate logic structures and coding statements. The event-driven nature of Visual Basic further requires that students learn how to organize their code into appropriate events related to GUI objects.

Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach will furnish students with a problem-solving framework for developing event-driven programs. Through repeated illustrations of this framework in end-of-chapter case studies, students can see how to identify the major input, processing, and output needs of a program. From this list, they learn how to sketch an interface that serves all the needs identified during problem analysis. Next, they develop and document the macro-level logic by using an Object-Event Diagram (OED). The OED is a transitional tool that shows students how to use the interface they just designed to begin organizing their program into events that relate to specific objects. After the events have been identified, traditional program development tools are used to depict design logic, develop adequate test plans, translate logic designs into Visual Basic code, test and debug as necessary, and finalize the documentation of the package.

To further emphasize our focus on problem solving, chapter discussions and case studies use just three Visual Basic controls: text boxes, labels, and command buttons. For instructors who want to present additional controls, we include a comprehensive list of User Interface Objects in Appendix A. Having this information in a separate section gives the instructor total control of the amount and sequence of GUI coverage for a particular course. Related objects are grouped together in this section, and short examples are provided to illustrate their application. End-of-chapter problems also provide opportunities for instructors to cover additional controls, as needed or desired.

Approach

When event-driven tools such as Visual Basic were first introduced in the classroom, classroom coverage of the new GUI features made application development fun and exciting. Unfortunately, too much focus on GUI topics took important time away from teaching fundamental programming concepts. Students could develop intricate interfaces, but had difficulty organizing and developing the code underneath the GUI to make it do something. Our teaching philosophy for an introductory programming course is to equip students with the essential skills needed to develop computer applications using any language. This philosophy requires that students gain a framework for creating programs, not just memorize the syntax rules of a particular language.

Introduction to Computer Programming with Visual Basic 6 A Problem-Solving Approach was written in response to the need for a textbook that focuses on teaching programming. To accomplish this objective, we identified three goals for this book. First, we want to teach a disciplined process for developing a computer program that includes logic design before the coding step and sufficient testing after. Second, we want to teach universal programming concepts so that our students have the tools to transition to other programming languages. Third, we want the students to follow standards as they write their code, including naming and indentation conventions.

The disciplined process we recommend is introduced early in Chapter I and reinforced with a complete case study at the end of each chapter. To help students understand the relationship of GUI objects and their events, we developed a tool called the Object-Event Diagram (OED). As students transition from interface design to logic development, the OED helps them organize major processing steps using the event-driven paradigm. Because each event procedure is like a mini-program, there is still a need for logic design in the individual event procedures. Hence, both flowcharts and pseudocode are used in most of the chapters to illustrate major logic structures. Teachers can choose the one they like better. Pseudocode is easier to type and takes less space, but for the majority of students who tend to learn visually, seeing a graphical design tool increases their understanding.

To achieve the goal of teaching universal programming concepts, this book concentrates on the various logic structures and types of programming statements used in most programming languages, instead of teaching all the "bells and whistles" of Visual Basic. In chapter discussions and the majority of case studies, we have purposely elected to design GUIs that generally use only three controls: labels, text boxes, and command buttons. This does not mean, however, that the students must be limited to these controls. The fundamental concepts of properties, methods, and events apply to all GUI objects, so students should be able to transfer their understanding of these concepts when using "new" controls. In fact, the students should be encouraged to demonstrate their understanding of the general nature of screen objects by incorporating a new control in several programming exercises. Several exercises suggest modifying the chapter examples to incorporate new controls, or writing a new program to try a different control. Using Appendix A, "Visual Basic User Interface Objects," as a handy reference, the instructor has the added flexibility to use different controls in different semesters, or to introduce them in a different order.

Our final goal was the most challenging to achieve because each of us practiced slightly different standards. Our situation is not unlike what students will experience when they begin each new job. Students need to recognize that different languages and/or different companies are likely to have their own standards conventions. Therefore, to function effectively within the organization or with the new tool, they must learn the convention and then use it consistently to allow others to quickly read and understand the code. In selecting our standards for the text, we spent considerable time debating the advantages and disadvantages of each. In each case, our final decision was based on the pedagogical value of the specific standard in teaching a programming course.

We follow the widely accepted prefix notation standards for naming GUI objects, for example, but opted for a somewhat unique scope prefix. When using Visual Basic, students may notice that the word module has multiple definitions, depending on context. Traditional programming had yet another meaning for module to refer to blocks of code such as procedures and functions. Rather than add to the students' confusion by using the "m" prefix for "module" scope, we use the "f" prefix for "form" or "file" scope. This standard helps students remember that the placement of the declaration helps determine the variable's scope. Additionally, because one of our conventions is to explicitly declare the types of all variables, we elected not to include type prefixes on variable names. Because it is just as easy to press Shift+F2 on a variable to quickly look up its type, we thought that there was no added benefit to requiring type prefixes.

Assumptions About the Student

Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach is aimed primarily at the undergraduate introductory programming course. Because this course is typically offered in the freshman or sophomore year, this book could be used by a variety of two- or four-year institutions. Students from a wide variety of disciplines, both computingrelated and not, could benefit from a programming course like this to gain essential programming skills and improve their logical thinking.

Visual Basic is a Windows application with the typical File, Edit, and Help menus. Programmers must use the computer as a tool to type and edit their programs, which are then saved in files. Hence, this book assumes that readers have some basic computer literacy as well as mouse and keyboarding skills. It is helpful to have experience using at least one common Windows application such as a word processor or a spreadsheet, where you have used typical editing (cut, copy, and paste) and file manipulation (opening, saving) features. Additionally, because each Visual Basic program consists of multiple files, it is important to know how to create folders and how to copy, move, rename, or delete files.

Only basic math and algebra skills are assumed for this book, such as calculating a percentage, taking a percentage of another number (for example, sales tax), or converting units (for example, centimeters to inches). When more difficult math is required, the equation is provided. This means that students should be able to read an algebraic equation and recognize the mathematical operations required (multiplication, division, exponentiation, and so on) and their correct order of operations.

Key Features

The content and features of this book were designed to support our goal of teaching students how to program using any language. They are also a result of extensive class testing by all the authors.

Back to the Basics: Programming Fundamentals

This book concentrates on presenting a disciplined program development process, using fundamental logic control structures and teaching the concepts and statements of a programming language. Chapter 1, "Introductory Programming Concepts and the Visual Basic Environment," lays the foundation for the beginning programmer by introducing the six steps of program development. The remaining chapters follow through with illustrative case studies. Using a limited number of Visual Basic controls throughout the text gives the instructor more time to teach programming fundamentals and makes it possible for the student to concentrate on learning these fundamentals.

Case Studies

End-of-chapter case studies are used to illustrate and continually reinforce the six steps of the program development process. In each case study, a programming problem is presented and solved by following the steps from problem analysis through interface and logic design, coding, and testing. Complete documentation of the process is included in the case study section of each chapter. These examples also provide the instructor with complete problems that can be used for illustration purposes in lecture, developed together during lab, or studied by the students at home. Often at the end of the chapter, programming exercises ask the students to make modifications to the case study problem.

Appendix of Visual Basic User Interface Objects

Students learn the basic concepts of setting properties for GUI objects and putting code in an event procedure early in the book. Appendix A, "Visual Basic User Interface Objects," serves as a handy reference that groups related objects together and describes their primary uses, key properties, events, and methods. Many illustrative code examples are included. Students should be able to incorporate other GUI features on their forms. By moving the majority of the GUI discussion to the appendix, the main text can focus on algorithms and logic structures. An added benefit of this separate appendix is the increased flexibility for the instructor to cover specific GUI elements as appropriate and to cover different controls from semester to semester.

Appendix on Program Design and Translation to VB Code

Although the entire text uses a problem-solving approach, some instructors may find it useful to have a more thorough coverage of logic design in a separate section. Appendix B, "Program Design and Translation to VB Code," serves as a more complete reference for logic design concepts that employ flowcharts for visual illustrations. Furthermore, it includes a set of translation rules to convert design logic into corresponding Visual Basic code. For students who have already taken a problem-solving course, this appendix serves as a reference for the design standards used in this text. In other situations where an instructor wants to teach the logic design structures before doing any coding, or after learning a few basic coding statements, this appendix can be used as a teaching aid at the appropriate time of the semester, just like any other chapter. Finally, for students who follow the suggested process of design prior to coding, the list of translation rules can serve as a reference guide when they convert their program logic into Visual Basic code.

Object-Event Diagrams (OEDs)

Because Visual Basic is event-driven, where the code is written is as important as the code itself. Because this is not always obvious, particularly for people who do have experience with a traditional, structured programming language, the OED tool will help students think about the importance of the events, as well as document how their programs' procedures are organized. When following the recommended six step program development process, this tool provides students with a natural transition from user-interface development to macro-level logic design. The first level identifies the project, and the second level identifies GUI objects, all of which can be gleaned from the just-developed interface. The third level identifies the events that will respond to certain actions related to specific GUI objects. By considering the interface from the user's perspective, the student must think about what user actions will result in some immediate processing by the program. Each object may have zero, one, or many events that could result in some action by the program. For any event that seems to be fairly complex, traditional functional decomposition can be employed to subdivide an event into sub procedures and functions. The OED serves as a visual table of contents to the overall organization of code blocks and their relationship to GUI objects. Instructors can take advantage of this tool to document specific modularity requirements by providing students with the OED(s) for an assigned program. Using OEDs, students will realize which events must be coded and how to decompose them further, if necessary.

Reusable Code Module

Designing reusable code is a goal of many professional programmers, yet it takes good planning to be able to show students how to accomplish this in an introductory programming course. In this textbook, several procedures designed and coded in earlier chapters are used again in later chapters. The student is instructed to place these routines in a separate code module to make later reuse easier. Using these examples for ideas, instructors can add to this module or encourage students to add to this module when they write other general-purpose routines that may be useful in other programs.

Common Case Study for File, Database, and Object-Oriented Programming Chapters

Most of the illustrative examples and all the program case studies in Chapters 9—12 use the same or similar problems to illustrate the chapter's new concepts. This feature helps students recognize the value of each approach as well as the differences in implementation.

One Chapter on Files and Two Chapters on Database Programming

Visual Basic is a very popular tool used to develop business applications, and most business applications store data in some form of a relational database. Nonetheless, fundamental knowledge of sequential files is very important because it is still commonly used in industry to share data between applications and operating systems. Chapter 9, "Sequential Files," teaches the still common sequential file concepts.

Because the predominant types of business applications use databases rather than files, this textbook includes two chapters on database programming. Many textbooks teach students database programming using only the data control and bound controls. Although these techniques allow applications to be developed without much coding, their use is limited to simple examples. Chapter 10, "Introductory Database Programming," teaches fundamental database concepts using the data control and bound controls. Chapter 11, "Database Programming with Data Objects and SQL," introduces more advanced database programming using Data Access Objects (DAO) and SQL statements. Including this second chapter allows the instructor to teach more complex database programming topics and provides better preparation for programming database applications for industry.

Visual Basic 6.0 now includes Microsoft's latest database access technology: ActiveX Data Objects (ADO). ADO requires ODBC drivers and has been designed to allow access to many types of data, both in relational databases as well as nondatabase information such as your computer's folder and file structure. Although ADO might be the standard technique for data access in the future due to Microsoft's recommendation, it is still rather new and likely not as robust as DAO. DAO has been available since version 3.0 of Visual Basic, making it the most mature of the data object methods of database access in Visual Basic. It is a reliable choice for working with native jet databases, such as any of the Access databases illustrated in the textbook. Furthermore, the intrinsic data control also still uses DAO and is still likely the most efficient method for connecting directly to jet (MS Access, .MDB) databases. Because this book focuses on programming fundamentals, and because DAO is still the easiest database access technique to use, we elected to use DAO. Our decision is further supported in the article "VS 6.0 Benchmarks: New Features Don't Impact Speed," by Ash Rofail and Yasser Shohoud (Visual Basic Programmer's Journal Vol. 8, No. 14, December 1998).

Object-Oriented Programming Chapter

Chapter 12, "Object-Oriented Programming," is devoted to fundamental objectoriented programming concepts and techniques for developing object-oriented programs using Visual Basic. This is important because object-oriented programming is becoming an almost standard method for developing software. Although Visual Basic does not support true inheritance, it does support most objectoriented program development concepts. This chapter covers these concepts and techniques in more depth than other books targeted for introductory Visual Basic programming courses.

End-of-Chapter Evaluation and Test Material

The end-of-chapter materials include a "Key Terms" section that lists all the new terms introduced in the chapter, general "Test Your Understanding" questions that reinforce the reading material of the chapter, and "Programming Exercises." After Chapter 3, "Arithmetic Operators and Scope," every chapter also includes larger "Programming Projects." For adopting instructors, solutions to problems will be made available. These solutions can be used as grading keys or for classroom illustration. Students should try to define each key term and answer the "Test Your Understanding" questions. This quickly shows how well students have picked up each chapter's concepts. The exercises and projects provide activities that can be completed to improve programming skills and to learn the material better.

Program Standards and Style

Programming standards and style rules are introduced early, and consistently illustrated in the examples. These include the following:

  • Prefixes on all objects

  • Required variable declarations by inclusion of Option Explicit

  • Scope prefixes on variables and constants

  • Header blocks and comments in the code

  • Consistent indentation to allow quick identification of procedures and all logic structures

By developing good habits from the start, students should continue to develop programs that are easier to understand and maintain. Instructors benefit by having illustrative programs that follow good programming practice.

Another programming standard advocated by other authors and Visual Basic Help is the use of type prefixes on variable declarations; however, it is far from being standard practice. Browsing through a copy of any industry periodical (such as the Visual Basic Programmer's journal) or the sample applications that are included with Visual Basic illustrates this point. The use of type prefixes is still just a personal preference and its merits, particularly for local variable declarations, are questionable. We elected to use explicit type declarations with shorter names instead of adding another standards naming rule. Too many data types abound (you can even create your own data types). If you need to find an object's data type, just click it and press Shift+F2; Visual Basic jumps to the declaration statement.

Concerted Effort to Avoid Including Bad GUI Design and Coding Techniques

Students are not taught bad practices that will later have to be corrected if they pursue careers as software developers in industry. Many books teach students to use the End statement to terminate program execution. Although the End statement does immediately end the application, it does not allow important events such as Form_Unload and Class_Terminate to be executed. As documented in Visual Basic help, the correct way to end a VB application is to unload all forms from memory. This type of termination will allow all end-of-application processing to be completed.

In addition, user interfaces throughout the book are designed using simple controls with standard sizes. Students are encouraged to follow common Windows user-interface guidelines and are discouraged from creating ostentatious or inefficient user-interface designs. For example, we avoid using the picture box control because most of the examples can be designed with less system-intensive controls. Some instructors may wonder why we don't cover more of the controls that come with Visual Basic. ActiveX controls have the potential to increase programmer productivity. However, reckless use of ActiveX controls can cause severe application distribution problems. Our book does explain how to use some ActiveX controls, but also warns about their pitfalls.

Use of Online Aids Encouraged

Most software packages today come with online help facilities that may even duplicate the material found in any printed manuals that may be available. Students can become better programmers if they learn how to use these available tools to find answers to questions instead of first going to the instructor. The use of Visual Basic Help is illustrated in Chapter 2, "Data Types, Variables, and Assignment Statements," and reinforced with several exercises. Also introduced in Chapter 2 are some of the important debugging features of Visual Basic. Because the rudimentary instructions on using the built-in debugging aids are described in the text, the instructor can assign the reading and focus on other elements in the class. As each new logic structure is introduced, the instructor can then use the debugging features to trace the logic's execution. Students can refer to the instructions anytime to review how to trace through their programs.

Pedagogy

Every chapter contains a list of learning objectives immediately following the introduction. Throughout the chapter, students see small logic and program examples that they can implement as they read. Tips and Notes are highlighted in sidebars. All the key points of the chapter are brought together in a complete case study at the end of each chapter. Besides illustrating the main points of the chapter, the case study also reinforces the program development process, by discussing each step and showing the transition from one step to the next. Each case study starts with an analysis of the problem, which includes assessing its input, processing, and output needs. From this, a user interface is designed. Program design follows with a determination of key events for each control (diagrammed in one or more OEDs) and development of detailed logic for each event in the form of flowcharts and pseudocode. A test plan is also created at this stage using a table format containing a variety of data input and the expected results. The design is then translated into code, with suggestions for coding and testing in small segments. Selected output from the test data are shown to illustrate the expected results of the test data input by the programmer.

Each chapter ends with a summary of important concepts and a list of key terms. These are followed by a series of "Test Your Understanding" questions that require written responses based on the chapter reading. A number of "Programming Exercises" are provided to allow students to practice key concepts on the computer, and "Programming Projects" provide largerscale problems the students can use to practice the complete program development process.

Organization

Because many concepts of programming are interrelated and build on one another, this book was written under the basic assumption that students would start with Chapter 1 and cover each chapter in sequence. We selected the order of topics with the goal of presenting the more complex topics as early as possible to provide more opportunities for continued illustrations and reinforcement. For instructors who prefer some flexibility on the order of topics, the later section titled "Suggestions for Using This Text" highlights three alternatives for covering the material in a different order.

The chapter titles and a brief description are as follows:

Chapter 1: Introductory Programming Concepts and the Visual Basic Environment

This chapter introduces some programming terminology, presents the steps in program development, and familiarizes the student with the Visual Basic development environment. The student is encouraged to follow along to create, save, and run a short computer program. A simple case study is provided to discuss how the program development steps will be applied in future chapters. Flowcharting symbols are introduced so that both flowcharts and pseudocode can be presented in upcoming chapters.

Chapter 2: Data Types, Variables, and Assignment Statements

In this chapter, the student starts to learn how to program. Topics include deciding whether a value is string or numeric, whether to use a literal value or a variable, and how to assign values to object properties or variables. Comments, concatenation, and multiple forms are also included. Multiple forms are introduced to illustrate the use of a method (Show). Introducing multiple forms early sets the stage for the variable scope discussion in the next chapter.

Chapter 3: Arithmetic Operators and Scope

The primary goal of this chapter is to show how to perform calculations in Visual Basic. The arithmetic operators and their precedence are presented. The use of conversion functions to explicitly convert values between string and numeric types (for calculation and then for display) is encouraged. Different levels of variable scope are also discussed in detail. The remaining chapters can then illustrate all three levels of scope, as appropriate.

Chapter 4: Simplifying Programming Through Modularity

At this early stage, it is already possible to build programs that duplicate several statements. For example, a form with many text boxes may need to clear them, lock them, or unlock them from several parts of a program. Hence, the concept of creating additional program modules, similar to the way Visual Basic creates event procedures, is introduced in this chapter so that students can use this tool to simplify their program logic. Also, defining and calling procedures and functions is a difficult concept for many students. By introducing it early, there are many more opportunities throughout the semester to create and use functions and procedures so that students will become comfortable using them. A number of the functions and procedures provided in Visual Basic are also presented.

Chapter 5: Decisions and Data Validation

The various forms of the If-Then-Else statement are presented in this chapter, along with various types of data validation. The MsgBox and InputBox functions are introduced as possible tools to report bad data situations to the user. The nesting of If statements for more complex problems is also discussed.

Chapter 6: The Case Structure and Error Handling

This chapter covers several alternatives to the standard If-Then-Else statement, including use of Elself and Select Case. Because any problem using Elself or Select Case could be coded using regular If-Then-Else statements, the topics from this chapter could be skipped to provide more time to cover later topics. Chapter 6 also presents another alternative to If-Then-Else statements for data validation—trapping for errors using the On Error Go To and Resume statements. Finally, the use of random numbers can be useful in certain program situations related to decisions, so a discussion is also presented in this chapter.

Chapter 7: Repetitive Structures

Students are presented with a loop design process to follow after they have determined that repetition is necessary. Pre-test, post-test and counting loops are covered. The counting loop is presented as a special case of the pre-test loop. The discussion about loops with early exit illustrates two versions of a program. In one version, the loop uses a normal exit; in the other version, the loop contains an early exit.

Chapter 8: Arrays, Searching, and Sorting

The concept of arrays is presented, followed by their use in a number of algorithms. Loops are used heavily to process array values, display array values, search for values, and sort the arrays. Both the sequential and binary search are discussed. Only the selection sort is discussed, which gives students a chance to see nested loops. Static and dynamic dimensioning of arrays is included. Several examples of where arrays are built in to Visual Basic, such as control arrays, combo boxes, and list boxes, are mentioned. Finally, userdefined types (UDTs) are presented as a means for storing together all related information of different types. UDTs are then applied to arrays in the chapter case study.

Chapter 9: Sequential Files

Four types of sequential files, along with sample programs for each type, are covered in this chapter. A file containing records with comma-separated values (CSV) is presented as an example of a file with variable record-length records. Display-formatted records are described and a sample program is developed for this type of file. Two types of files with fixedlength records are also discussed in depth. The case study program at the end of the chapter designs and develops a program that reads two files, accepts user input, and produces an output file. Variations of this program are also developed in the two database chapters, Chapters 10 and 11.

Chapter 10: Introductory Database Programming

This chapter shows the student how to use the data control to access data in a database. Techniques for retrieving and modifying database data are presented, as well as the Visual Basic statements used to work with these databases. Steps to create an application that navigates a database by setting specific properties of the data control and data bound controls without writing any code are illustrated. Steps for writing code to customize the database access to search, add, delete, and modify information in the database are also presented. The case study processes the same data from Chapter 9, but uses databases for storage and retrieval. By covering both chapters, the student can see the differences in implementation when using files rather than databases.

Chapter 11: Database Programming with Data Objects and SQL

When creating more complex applications (multiple-user or client/server), developers use Visual Basic's database objects rather than the data control and write their own code using structured query language (SQL) to do much of the processing that is handled by bound controls. Chapter 11 illustrates many of these techniques using the Data Access Objects (DAO) model. The same data from Chapters 9 and 10 is used for comparison purposes.

Chapter 12: Object-Oriented Programming

In this chapter, the principles of Object-Oriented Programming (OOP) are discussed as well as how you apply them in Visual Basic. The chapter discusses how to create your own objects by using classes and property procedures. Additionally, the Visual Basic Collection is introduced as a way of making working with lists of objects a bit easier. The same data from Chapters 9-11 is used for comparison purposes.

Appendix A: Visual Basic User Interface Objects

The purpose of Appendix A is to list commonly used Graphical User Interface (GUI) objects and their commonly used properties, events, and methods. Forms, intrinsic controls, menus, and ActiveX controls are all discussed. Brief coding examples are included to illustrate how these objects are typically used. The complete code for all examples at the end of each section is included.

Appendix B: Program Design and Translation to VB Code

Graphical flowcharts are one type of tool used by program designers to visually document their program's logic. Appendix B defines standardized, graphical flowcharting notation for depicting the logic for program solutions. It also provides a set of translation rules to convert these graphical flowchart solutions into equivalent Visual Basic code.

Appendix C: Useful Functions, Procedures, and Statements

Visual Basic has numerous intrinsic functions, procedures, and assorted statements to make programming easier. Appendix C lists a subset of the ones we think will be the most useful. The student is encouraged to use this appendix to get a general idea of what is available, and to then use the Visual Basic Help file for complete descriptions and syntax. Some of these keywords are listed in previous chapters and are repeated here for completeness.

Tear Card

A flexible and easy-to-use tear card appears in the front of the book. Two important items are included on this card: (1) "Suggested Prefixes for Visual Basic Controls" lists the recommended three-character prefixes for most of the commonly used objects; and (2) "Table of ASCII Values" provides the numeric ASCII code and corresponding character of each of the 256 possible character values. When comparing strings, it is useful to know these values to determine which characters are "less than" or "greater than" other characters. Visual Basic also contains functions and events (for example, Asc, Chr, KeyPress) that require knowledge of each character's ASCII value.

Suggestions for Using This Text

In a typical 15-week semester, we can usually cover 75 percent of this text. During class testing in the Fall 1998 semester, our course for majors covered Appendix B and Chapters 1-9. Students were referred to Appendix A only after fundamental programming concepts had been covered. Even then, they used it as a reference to learn how to include option buttons, check boxes, frames, and two or three other controls in their program exercises or projects. During the same time, the non-majors course covered Chapters 1-9. In prior semesters in the non-majors course, material equivalent to Chapters 1-10, Appendix B, and half of Appendix A was covered. Sometimes Appendix B has been used in its entirety before presenting any Visual Basic specifics, to concentrate only on logic structures. Other times, the logic was presented in the chapters along with the corresponding coding statements as needed.

Added Flexibility with Controls Appendix

Grouping the Visual Basic controls discussions in Appendix A provides a great deal of flexibility to instructors. Instructors who want to concentrate on developing logic design and coding skills can just follow the regular chapters and tell students to read the appendix on their own to learn about using other controls. Instructors who like to vary the assignments from one semester to another are free to use different controls each semester. Also, because the controls are not tied to a particular chapter, they can be learned in any order. Instructors who want to teach more specifically about the Visual Basic environment can pick one or two controls to teach along with each chapter.

The Teaching Package: Print and Technology Resources

We have developed a comprehensive print and technology teaching and learning resources package that is coordinated with the main text and designed to maximize teaching flexibility and convenience. An accompanying CD-ROM contains student project files. Visual Basic 6.0 can be used in conjunction with this book. An Instructor's Resource Manual and Test Bank includes the following:

  • Guidance on how to integrate Appendix A controls throughout the book

  • Solutions to all end-of-chapter questions, exercises, and projects

  • Test bank of questions, including multiple-choice questions

  • Solutions disc

A supporting Web site at www.queet.com includes additional teaching resources.

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership