Programming With Microsoft Visual Basic 2015 7th Edition Diane Zak download
Programming With Microsoft Visual Basic 2015 7th Edition Diane Zak download
https://ebookbell.com/product/programming-with-microsoft-visual-
basic-2015-7th-edition-diane-zak-5312274
https://ebookbell.com/product/programming-with-microsoft-visual-
basic-2012-6th-edition-zak-55132386
https://ebookbell.com/product/programming-with-microsoft-visual-
basic-2010-vbnet-programming-5th-edition-zak-55139980
Programming With Microsoft Visual Basic 2017 Mindtap Course List 8th
Edition Zak
https://ebookbell.com/product/programming-with-microsoft-visual-
basic-2017-mindtap-course-list-8th-edition-zak-55132312
Clearly Visual Basic Programming With Microsoft Visual Basic 2010 2nd
Edition Diane Zak
https://ebookbell.com/product/clearly-visual-basic-programming-with-
microsoft-visual-basic-2010-2nd-edition-diane-zak-2382420
Clearly Visual Basic Programming With Microsoft Visual Basic 2012 3rd
Edition Diane Zak
https://ebookbell.com/product/clearly-visual-basic-programming-with-
microsoft-visual-basic-2012-3rd-edition-diane-zak-4178308
https://ebookbell.com/product/programming-microsoft-windows-with-
microsoft-visual-basic-net-core-reference-prodeveloper-illustrated-
edition-petzold-1273112
Programming Microsoft Sql Server 2000 With Microsoft Visual Basic Net
1st Edition Dobson
https://ebookbell.com/product/programming-microsoft-sql-
server-2000-with-microsoft-visual-basic-net-1st-edition-
dobson-55141988
Microsoft Aspnet Programming With Visual Basic Net Version 2003 Step
By Step 1st Edition G Andrew Duthie
https://ebookbell.com/product/microsoft-aspnet-programming-with-
visual-basic-net-version-2003-step-by-step-1st-edition-g-andrew-
duthie-1352776
https://ebookbell.com/product/programming-with-microsoft-visual-c-net-
sixth-edition-george-shepherd-david-kruglinski-62157456
PROGRAMMING WITH
MICROSOFT® VISUAL BASIC® 2015
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Seventh Edition
PROGRAMMING
WITH MICROSOFT®
VISUAL BASIC® 2015
DIANE ZAK
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions,
some third party content may be suppressed. Editorial review has deemed that any suppressed
content does not materially affect the overall learning experience. The publisher reserves the right
to remove content from this title at any time if subsequent rights restrictions require it. For
valuable information on pricing, previous editions, changes to current editions, and alternate
formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for
materials in your areas of interest.
Important Notice: Media content referenced within the product description or the product
text may not be available in the eBook version.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Programming with Microsoft® Visual Basic® © 2016 Cengage Learning
2015, Seventh Edition
WCN: 02-200-203
Diane Zak
Product Director: Kathleen McMahon ALL RIGHTS RESERVED. No part of this work covered by the copyright
herein may be reproduced, transmitted, stored or used in any form or by
Product Team Manager: Kristin McNary any means graphic, electronic, or mechanical, including but not limited to
Senior Product Manager: Jim Gish photocopying, recording, scanning, digitizing, taping, Web distribution,
Senior Content Developer: Alyssa Pratt information networks, or information storage and retrieval systems, except
as permitted under Section 107 or 108 of the 1976 United States Copyright
Product Assistant: Abigail Pufpaff
Act, without the prior written permission of the publisher.
Marketing Manager: Eric LaScola
Senior Production Director:
For product information and technology assistance, contact us at
Wendy Troeger Cengage Learning Customer & Sales Support, 1-800-354-9706
Production Director: Patty Stephan For permission to use material from this text or product, submit all
Senior Content Project Manager: requests online at www.cengage.com/permissions
Jennifer K. Feltri-George Further permissions questions can be emailed to
[email protected]
Managing Art Director: Jack Pendleton
Cover image(s):
Library of Congress Control Number: 2015940168
© Rudchenko Liliia/Shutterstock.com
ISBN: 978-1-285-86026-8
Unless otherwise noted all screenshots are
Cengage Learning
courtesy of Microsoft Corporation
20 Channel Center Street
Open Clip art source: OpenClipArt Boston, MA 02210
USA
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
v
Brief Contents
Pref ace . . . . . . . . . . . . . . . . . . . . . . . . . xv i i
Read T h is B ef o re You Begi n . . . . . . . . . . . . . . . . xxi i
O verview An In t ro du ct io n to Programmi ng . . . . . . . . . . . . . . . 1
Chapter 1 An In t ro du ct io n to V i sual Basi c 2 0 1 5 . . . . . . . . . . . . . 9
Chapter 2 Des ig n in g Applicati ons . . . . . . . . . . . . . . . . . . 59
Chapter 3 U s in g Var iables and Constants . . . . . . . . . . . . . . . 111
Chapter 4 T h e Select io n Structure . . . . . . . . . . . . . . . . . . 179
Chapter 5 M o re o n t h e Selecti on Structure . . . . . . . . . . . . . . 247
Chapter 6 T h e Repet it io n Structure . . . . . . . . . . . . . . . . . 315
Chapter 7 Su b an d F u n ct ion Procedures . . . . . . . . . . . . . . . 389
Chapter 8 St r in g M an ipu lati on . . . . . . . . . . . . . . . . . . . . 449
Chapter 9 Ar r ays . . . . . . . . . . . . . . . . . . . . . . . . . 499
Chapter 10 St r u ct u res an d Sequenti al Access Fi l es . . . . . . . . . . . 559
Chapter 11 Clas s es an d Obj ects . . . . . . . . . . . . . . . . . . . 609
Chapter 12 Web Applicat io ns . . . . . . . . . . . . . . . . . . . . . 671
Chapter 13 Wo r k in g w it h Access Databases and LI NQ . . . . . . . . . . 723
Chapter 14 Acces s Dat abases and SQL . . . . . . . . . . . . . . . . 777
A ppendix A F in din g an d F ixing Program Errors . . . . . . . . . . . . . 821
A ppendix B GU I Des ig n Gu idel i nes . . . . . . . . . . . . . . . . . . 839
A ppendix C V is u al B as ic Co nv ersi on Functi ons . . . . . . . . . . . . . 845
A ppendix D V is u al B as ic 201 5 Cheat Sheet . . . . . . . . . . . . . . 847
A ppendix E Cas e Pro ject s . . . . . . . . . . . . . . . . . . . . . . 865
A ppendix F M u lt iple F o r m s and Di al og Box es . . . . . . . . . . . . O nl i ne
Index . . . . . . . . . . . . . . . . . . . . . . . . . . 869
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
vi
Contents
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
vii
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
viii
Contents
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
ix
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
x
Contents
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xi
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xii
Contents
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xiii
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xiv
Contents
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xv
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xvi
Contents
I n dex . . . . . . . . . . . . . . . . . . . . . . . . . . 869
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xvii
Preface
Programming with Microsoft Visual Basic 2015, Seventh Edition uses Visual Basic 2015, an
object-oriented language, to teach programming concepts. This book is designed for a beginning
programming course. However, it assumes students are familiar with basic Windows skills and
file management.
Approach
Programming with Microsoft Visual Basic 2015, Seventh Edition teaches programming concepts
using a task-driven rather than a command-driven approach. By working through the chapters,
which are each motivated by a realistic case, students learn how to develop applications they
are likely to encounter in the workplace. This is much more effective than memorizing a list of
commands out of context. The book motivates students by demonstrating why they need to
learn the concepts and skills covered in each chapter.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xviii
P r e fa c e Organization and Coverage
Features
Programming with Microsoft Visual Basic 2015, Seventh Edition is an exceptional textbook
because it also includes the following features:
READ THIS BEFORE YOU BEGIN This section is consistent with Cengage Learning’s
unequaled commitment to helping instructors introduce technology into the classroom.
Technical considerations and assumptions about hardware, software, and default settings are
listed in one place to help instructors save time and eliminate unnecessary aggravation.
YOU DO IT! BOXES These boxes provide simple applications that allow students to
demonstrate their understanding of a concept before moving on to the next concept. The YOU
DO IT! boxes are located almost exclusively in Lesson A of each chapter.
VISUAL STUDIO 2015 METHODS The book focuses on Visual Studio 2015 methods rather
than on Visual Basic functions. Exceptions to this are the Val and Format functions, which are
introduced in Chapter 2. These functions are covered in the book simply because it is likely that
students will encounter them in existing Visual Basic programs. However, in Chapter 3, the
student is taught to use the TryParse method and the Convert class methods rather than the
Val function. Also in Chapter 3, the Format function is replaced with the ToString method.
OPTION STATEMENTS All programs include the Option Explicit, Option Strict, and Option
Infer statements.
START HERE ARROWS These arrows indicate the beginning of a tutorial steps section in
the book.
DATABASES, LINQ, AND SQL The book includes two chapters (Chapters 13 and 14) on
databases. LINQ is covered in Chapter 13. SQL is covered in Chapter 14.
FIGURES Figures that introduce new statements, functions, or methods contain both the
syntax and examples of using the syntax. Including the syntax in the figures makes the examples
more meaningful, and vice versa.
CHAPTER CASES Each chapter begins with a programming-related problem that students
could reasonably expect to encounter in business, followed by a demonstration of an application
that could be used to solve the problem. Showing the students the completed application before
they learn how to create it is motivational and instructionally sound. By allowing the students to
see the type of application they will be able to create after completing the chapter, the students
will be more motivated to learn because they can see how the programming concepts they are
about to learn can be used and, therefore, why the concepts are important.
LESSONS Each chapter is divided into three lessons—A, B, and C. Lesson A introduces
the programming concepts that will be used in the completed application. The concepts are
illustrated with code examples and sample applications. The user interface for each sample
application is provided to the student. Also provided are tutorial-style steps that guide the
student on coding, running, and testing the application. Each sample application allows the
student to observe how the current concept can be used before the next concept is introduced.
In Lessons B and/or C, the student creates the application required to solve the problem
specified in the Chapter Case.
APPENDICES Appendix A, which can be covered after Chapter 3, teaches students how to locate
and correct errors (syntax, logic, and run time) in their code. The appendix shows
students how to step through their code and also how to create breakpoints. Appendix B
summarizes the GUI design guidelines taught in the chapters, making it easier for the student to
follow the guidelines when designing an application’s interface. Appendix C lists the Visual Basic
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xix
Organization and Coverage
conversion functions. Appendix D contains a Cheat Sheet that summarizes important concepts
covered in the chapters, such as the syntax of statements, methods, and so on. The Cheat Sheet
provides a convenient place for students to locate the information they need as they are creating and
coding their applications. Appendix E contains Case Projects that can be assigned after completing
specific chapters in the book. Appendix F, which is available online at CengageBrain.com, covers
multiple-form applications and the FontDialog, ColorDialog, and TabControl tools.
GUI DESIGN TIP BOXES The GUI DESIGN TIP boxes contain guidelines and
recommendations for designing applications that follow Windows standards. Appendix B
provides a summary of the GUI design guidelines covered in the chapters.
TIP These notes provide additional information about the current concept. Examples
include alternative ways of writing statements or performing tasks, as well as warnings
about common mistakes made when using a particular command and reminders of related
concepts learned in previous chapters.
SUMMARY Each lesson contains a Summary section that recaps the concepts covered in
the lesson.
KEY TERMS Following the Summary section in each lesson is a listing of the key terms
introduced throughout the lesson, along with their definitions.
REVIEW QUESTIONS Each lesson contains Review Questions designed to test a student’s
understanding of the lesson’s concepts.
EXERCISES The Review Questions in each lesson are followed by Exercises, which provide
students with additional practice of the skills and concepts they learned in the lesson. The
Exercises are designated as INTRODUCTORY, INTERMEDIATE, ADVANCED, DISCOVERY,
and SWAT THE BUGS. The DISCOVERY Exercises encourage students to challenge and
independently develop their own programming skills while exploring the capabilities of Visual
Basic 2015. The SWAT THE BUGS Exercises provide an opportunity for students to detect and
correct errors in an application’s code.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xx
P r e fa c e MindTap
Instructor Resources
The following teaching tools are available for download at our Instructor Companion Site.
Simply search for this text at sso.cengage.com. An instructor login is required.
INSTRUCTOR’S MANUAL The Instructor’s Manual that accompanies this textbook includes
additional instructional material to assist in class preparation, including items such as Sample
Syllabi, Chapter Outlines, Technical Notes, Lecture Notes, Quick Quizzes, Teaching Tips,
Discussion Topics, and Additional Case Projects.
TEST BANK Cengage Learning Testing Powered by Cognero is a flexible, online system that
allows you to:
•• author, edit, and manage test bank content from multiple Cengage Learning solutions
•• create multiple test versions in an instant
•• deliver tests from your LMS, your classroom or wherever you want
POWERPOINT PRESENTATIONS This book offers Microsoft PowerPoint slides for each
chapter. These are included as a teaching aid for classroom presentation, to make available
to students on the network for chapter review, or to be printed for classroom distribution.
Instructors can add their own slides for additional topics they introduce to the class.
SOLUTION FILES Solutions to the Lesson applications and the end-of-lesson Review
Questions and Exercises are provided.
DATA FILES Data Files are necessary for completing the computer activities in this book.
Data Files can also be downloaded by students at CengageBrain.com.
MindTap
MindTap is a personalized teaching experience with relevant assignments that guide students to
analyze, apply, and improve thinking, allowing you to measure skills and outcomes with ease.
•• Personalized Teaching: Becomes yours with a Learning Path that is built with key student
objectives. Control what students see and when they see it. Use it as-is or match to your
syllabus exactly–hide, rearrange, add and create your own content.
•• Guide Students: A unique learning path of relevant readings, multimedia and activities
that move students up the learning taxonomy from basic knowledge and comprehension to
analysis and application.
•• Promote Better Outcomes: Empower instructors and motivate students with analytics
and reports that provide a snapshot of class progress, time in course, engagement and
completion rates.
The MindTap for Programming with Microsoft Visual Basic 2015 includes videos, study tools,
and interactive quizzing, all integrated into a full eReader that contains the full content from
the printed text.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxi
Acknowledgments
Acknowledgments
Writing a book is a team effort rather than an individual one. I would like to take this
opportunity to thank my team, especially Alyssa Pratt (Senior Content Developer), Heidi Aguiar
(Full Service Project Manager), Serge Palladino and John Freitas (Quality Assurance), Jennifer
Feltri-George (Senior Content Project Manager), and the compositors at GEX Publishing
Services. Thank you for your support, enthusiasm, patience, and hard work. Last, but certainly
not least, I want to thank the following reviewers for their invaluable ideas and comments: Cliff
Brozo, Monroe College; Anthony Cameron, Fayetteville Technical Community College, and
Tatyana Feofilaktova, ASA College. And a special thank you to Sally Douglas (College of Central
Florida) for suggesting the YOU DO IT! boxes several editions ago.
Diane Zak
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxii
Technical Information
Data Files
You will need data files to complete the computer activities in this book. Your instructor may
provide the data files to you. You may obtain the files electronically at CengageBrain.com and
then navigating to the page for this book.
Each chapter in this book has its own set of data files, which are stored in a separate folder
within the VB2015 folder. The files for Chapter 1 are stored in the VB2015\Chap01 folder.
Similarly, the files for Chapter 2 are stored in the VB2015\Chap02 folder. Throughout this book,
you will be instructed to open files from or save files to these folders.
You can use a computer in your school lab or your own computer to complete the steps and
Exercises in this book.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxiii
Technical Information
To start and configure Visual Studio to match the figures and tutorial
steps in this book:
1. Use the steps on Page 11 to start Visual Studio.
2. Use the steps on Pages 12 and 13 to configure Visual Studio.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxiv
Read This Technical Information
7. Click the OK button to close the Choose Toolbox Items dialog box. If the message “The
following controls were successfully added to the toolbox but are not enabled in the
active designer:” appears, click the OK button. The PrintForm control (as well as any
other PowerPacks controls you selected) will not appear in the Toolbox window until
you either create a new Visual Basic application or open an existing one. You will learn
how to perform both of those tasks in Chapter 1.
Figures
The figures in this book reflect how your screen will look if you are using Microsoft Visual
Studio Ultimate 2015 and a Microsoft Windows 8 system. Your screen may appear slightly
different in some instances if you are using another version of either Microsoft Visual Studio or
Microsoft Windows.
To the Instructor
To complete the computer activities in this book, your students must use a set of data files.
These files can be obtained on the Instructor Companion Site or at CengageBrain.com.
The material in this book was written using Microsoft Visual Studio Ultimate 2015 on a
Microsoft Windows 8 system. It was Quality Assurance tested using Microsoft Visual Studio
Ultimate 2015 on a Microsoft Windows 10 system.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
OVERVIEW
An Introduction to
Programming
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
2
OVERVIEW An Introduction to Programming
Programming a Computer
In essence, the word programming means giving a mechanism the directions to accomplish a
task. If you are like most people, you have already programmed several mechanisms, such as
your digital video recorder (DVR), cell phone, or coffee maker. Like these devices, a computer
also is a mechanism that can be programmed.
The directions (typically called instructions) given to a computer are called computer programs
or, more simply, programs. The people who write programs are called programmers.
Programmers use a variety of special languages, called programming languages, to
communicate with the computer. Some popular programming languages are Visual Basic, C#,
C++, and Java. In this book, you will use the Visual Basic programming language.
Employment Opportunities
When searching for a job in computer programming, you will encounter ads for “computer
programmers” as well as for “computer software engineers.” Although job titles and
descriptions vary, computer software engineers typically are responsible for designing an
Overview-Programmer appropriate solution to a user’s problem, while computer programmers are responsible
Qualities for translating the solution into a language that the computer can understand—a process
called coding. Software engineering is a higher-level position that requires the ability to
envision solutions. Using a construction analogy, software engineers are the architects, while
programmers are the carpenters.
Keep in mind that depending on the employer as well as the size and complexity of the user’s
problem, the design and coding tasks may be performed by the same employee, no matter what
his or her job title is. In other words, it is not unusual for a software engineer to code his or her
solution or for a programmer to have designed the solution he or she is coding.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
3
Visual Basic 2015
Programmers and software engineers need to have strong problem-solving and analytical skills,
as well as the ability to communicate effectively with team members, end users, and other
nontechnical personnel. Typically, computer software engineers are expected to have at least
a bachelor’s degree in software engineering, computer science, or mathematics, along with
practical work experience, especially in the industry in which they are employed. Computer
programmers usually need at least an associate’s degree in computer science, mathematics, or
information systems, as well as proficiency in one or more programming languages.
Computer programmers and software engineers are employed by companies in almost every
industry, such as telecommunications companies, software publishers, financial institutions,
insurance carriers, educational institutions, and government agencies. The U.S. Bureau of
Labor Statistics predicts that employment of computer software engineers will increase by
22% from 2012 to 2022. The employment of computer programmers, on the other hand,
will increase by 8% over the same period. In addition, consulting opportunities for freelance
programmers and software engineers are expected to increase as companies look for ways to
reduce their payroll expenses.
There is a great deal of competition for programming and software engineering jobs, so
jobseekers need to keep up to date with the latest programming languages and technologies.
A competitive edge may be gained by obtaining vendor-specific or language-specific
certifications, as well as knowledge of a prospective employer’s business. More information
about computer programmers and computer software engineers can be found on the U.S.
Bureau of Labor Statistics Web site at www.bls.gov.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
4
OVERVIEW An Introduction to Programming
application using your computer’s browser. Examples of Web applications include e-commerce
applications available on the Internet and employee handbook applications accessible on a
company’s intranet. You can also use Visual Basic to create applications for tablet PCs and
mobile devices, such as cell phones.
Don’t be
concerned if
some of the
letters on
your screen
are not underlined.
text box
You can show/hide the
underlined letters by
pressing the Alt key. list box
radio buttons
labels
buttons
3. Use the application to calculate the monthly payment for a $22,000 loan at 3.75%
interest for five years. Type 22000 in the Principal text box. Scroll down the Interest
list box and then click 3.75 %. The radio button corresponding to the five-year term is
already selected, so you just need to click the Calculate button to compute the monthly
payment. The application indicates that your monthly payment would be $402.69.
See Figure 2.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
5
Using the Chapters Effectively
4. Now determine what your monthly payment would be if you borrowed $5,000 at 4.5%
interest for four years. Type 5000 in the Principal text box, click 4.50 % in the Interest
list box, click the 4 years radio button, and then click the Calculate button. The
Monthly payment box shows $114.02.
5. Click the Exit button to close the application.
Each chapter is divided into three lessons. You might want to take a break between lessons.
Following each lesson is a Summary section that lists the important elements of the lesson.
After the Summary section is a list of the key terms (including definitions) covered in the lesson.
Following the Key Terms section are questions and exercises designed to review and reinforce
the lesson’s concepts. You should complete all of the end-of-lesson questions and several
exercises before continuing to the next lesson. It takes a great deal of practice to acquire the
skills needed to create good programs, and future chapters assume that you have mastered the
information found in the previous chapters.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
6
OVERVIEW An Introduction to Programming
Some of the end-of-lesson exercises are Discovery exercises, which allow you to both “discover”
the solutions to problems on your own and experiment with material that is not covered in
the chapter. Some lessons also contain one or more Debugging exercises. In programming, the
term debugging refers to the process of finding and fixing any errors, called bugs, in a program.
Debugging exercises provide opportunities for you to find and correct the errors in existing
applications. Appendix A, which can be covered after completing Chapter 3, guides you through
the process of locating and correcting a program’s errors (bugs).
Throughout the book, you will find GUI (graphical user interface) design tips. These tips
contain guidelines and recommendations for designing applications. You should follow these
guidelines and recommendations so that your applications conform to the Windows standards.
Summary
•• Programs are the step-by-step instructions that tell a computer how to perform a task.
•• Programmers use various programming languages to communicate with the computer.
•• The creation of a good program requires a great deal of interaction between the programmer
and the user.
•• Programmers rigorously test a program with sample data before releasing the program to
the user.
•• It’s not unusual for the same person to perform the duties of both a software engineer and a
programmer.
•• An object-oriented programming language, such as Visual Basic 2015, enables programmers
to use objects to accomplish a program’s goal. An object is anything that can be seen,
touched, or used.
•• Every object in an object-oriented program is instantiated (created) from a class, which is a
pattern that tells the computer how the object should look and behave. An object is referred
to as an instance of the class.
•• The process of locating and correcting the errors (bugs) in a program is called debugging.
The Windows •• To control the display of filename extensions, press and hold down the Windows logo
logo key looks key on your keyboard as you tap the letter x. Click Control Panel, click Appearance and
like this . Personalization, click Folder Options, and then click the View tab. Deselect the Hide
extensions for known file types check box to show the extensions; or, select the check box
to hide them.
Key Terms
Applications—programs created for the Windows environment, the Web, or mobile devices
Class—a pattern that the computer uses to create (instantiate) an object
Coding—the process of translating a solution into a language that the computer can understand
Computer programs—the directions given to computers; also called programs
Debugging—the process of locating and correcting the errors (bugs) in a program
IDE—integrated development environment
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
7
Key Terms
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CHAPTER 1
An Introduction to
Visual Basic 2015
In this chapter, you will use Visual Basic 2015, Microsoft’s newest version of the
Visual Basic language, to create a splash screen for the Crighton Zoo. A splash
screen is the first image that appears when an application is started. It is used to
introduce the application and to hold the user’s attention while the application is
being read into the computer’s internal memory.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
10
CHAPTER 1 An Introduction to Visual Basic 2015
You can also 1. Use Windows to locate and then open the VB2015\Chap01 folder on your computer’s
double-click the hard disk or on the device designated by your instructor. Right-click Zoo Splash (Zoo
filename to run Splash.exe) in the list of filenames and then click the Open button. (Depending on
the application. how Windows is set up on your computer, you may or may not see the .exe extension
on the filename. Refer to the Overview’s Summary section to learn how to show/hide
filename extensions.) After a few moments, the splash screen shown in Figure 1-1
appears on the screen. The splash screen closes when six seconds have elapsed.
Chapter 1 is designed to help you get comfortable with the Visual Studio 2015 integrated
development environment (IDE). As you learned in the Overview, an IDE is an environment that
contains all of the tools and features you need to create, run, and test your programs. Like all the
chapters in this book, Chapter 1 contains three lessons. You should complete a lesson in full and
do all of the end-of-lesson questions and several exercises before continuing to the next lesson.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
11
The Splash Screen Application L E S S O N A
❚ L ES S ON A
After studying Lesson A, you should be able to:
•• Start and customize Visual Studio 2015
•• Create a Visual Basic 2015 Windows application
•• Manage the windows in the IDE
•• Set the properties of an object
•• Restore a property to its default setting
•• Save a solution
•• Close and open an existing solution
1. If necessary, tap the Windows logo key to switch to the Windows 8 tile-based mode, The Windows
and then click the Visual Studio 2015 tile. logo key looks
like this .
2. If the Choose Default Environment Settings dialog box appears, click Visual Basic
Development Settings and then click Start Visual Studio.
If the Choose Default Environment Settings dialog box does not appear, click Tools on
the menu bar, click Import and Export Settings, select the Reset all settings radio
button, click the Next button, select the No, just reset settings, overwriting my
current settings radio button, click the Next button, click Visual Basic, and then click
the Finish button. Click the Close button to close the Import and Export Settings
Wizard dialog box.
3. Click Window on the menu bar, click Reset Window Layout, and then click the Yes
button. When you start Visual Studio Ultimate 2015, your screen will appear similar to
Figure 1-2. However, your menu bar may not contain underlined letters, called access
keys. You will learn about access keys in Chapter 2. (You can show/hide the access keys
by pressing the Alt key on your keyboard.)
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
12
CHAPTER 1 An Introduction to Visual Basic 2015
Solution Explorer
Start Page window window
Toolbox
window’s tab
Team Explorer
window’s tab
Next, you will configure Visual Studio so that your screen and tutorial steps agree with the
figures and tutorial steps in this book. As mentioned in the Overview, the figures reflect how
your screen will look if you are using Visual Studio Ultimate 2015 and a Microsoft Windows 8
system. Your screen may vary in some instances if you are using a different edition of Visual
Studio or if you are using another version of Microsoft Windows. Don’t worry if your screen
display differs slightly from the figures.
START H ERE To configure Visual Studio:
1. Click Tools on the menu bar and then click Options to open the Options dialog box.
Click the Projects and Solutions node. Use the information shown in Figure 1-3 to
select and deselect the appropriate check boxes.
The color of
your dialog
boxes depends
on your
computer’s
desktop theme.
select and
deselect the
appropriate
check boxes
Projects and
Solutions node
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
13
The Splash Screen Application L E S S O N A
2. Expand the Text Editor node and then expand the All Languages node. Click
CodeLens and then deselect the Enable CodeLens check box.
3. Click the Debugging node and then deselect the Step over properties and operators
(Managed only) check box. Also deselect the Show elapsed time PerfTip while
debugging check box, which appears at the bottom of the list.
4. Click the OK button to close the Options dialog box.
Note: If you change your default environment settings after performing the previous
four steps, you will need to perform the steps again.
The splash screen will be a Windows application, which means it will have a Windows user
interface and run on a desktop (or laptop) computer. Recall that a user interface is what the user
sees and interacts with while an application is running. Windows applications in Visual Basic are
composed of solutions, projects, and files. A solution is a container that stores the projects and
files for an entire application. Although the solutions in this book contain only one project,
a solution can contain several projects. A project is also a container, but it stores only the files
associated with that particular project.
To create a Visual Basic 2015 Windows application: STA R T HER E
1. Click File on the menu bar and then click New Project to open the New Project dialog
box. If necessary, click the Visual Basic node in the Installed Templates list, and then
click Windows Forms Application in the middle column of the dialog box.
2. Change the name entered in the Name box to Splash Project.
3. Click the Browse button to open the Project Location dialog box. Locate and then
click the VB2015\Chap01 folder. Click the Select Folder button to close the Project
Location dialog box.
4. If necessary, select the Create directory for solution check box in the New Project
dialog box. Change the name entered in the Solution name box to Splash Solution.
Figure 1-4 shows the completed New Project dialog box in Visual Studio Ultimate 2015.
(Your dialog box may look slightly different if you are using another edition of Visual
Studio. Do not be concerned if your dialog box shows a different version of the .NET
Framework.)
Figure 1-4 Completed New Project dialog box in Visual Studio Ultimate 2015
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
14
CHAPTER 1 An Introduction to Visual Basic 2015
To size the 5. Click the OK button to close the New Project dialog box. The computer creates a
Solution solution and adds a Visual Basic project to the solution. The names of the solution and
Explorer and project, along with other information pertaining to the project, appear in the Solution
Properties Explorer window. See Figure 1-5. In addition to the windows shown earlier in Figure 1-2,
windows, three other windows appear in the IDE: Windows Form Designer, Properties, and Data
position your mouse
Sources. (Don’t be concerned if different properties appear in your Properties window.)
pointer on the left
border of one of the
windows until the
mouse pointer becomes
a sizing pointer (a
horizontal line with an
arrowhead at each
end), and then drag the
border to either the left Data Sources
window’s tab solution and Auto Hide
or the right. button
project names
and information
Properties
window
Windows Form
Designer window
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
15
The Splash Screen Application L E S S O N A
5. To permanently display the Solution Explorer window, click the Solution Explorer tab
and then click the Auto Hide (horizontal pushpin) button on the window’s title bar.
The vertical pushpin replaces the horizontal pushpin on the button.
6. If necessary, close the Data Sources window.
7. If necessary, click Form1.vb in the Solution Explorer window. If the items in the
Properties window do not appear in alphabetical order, click the Alphabetical button.
(Refer to Figure 1-6 for the button’s location.)
8. Figure 1-6 shows the current status of the windows in the IDE. Only the Windows Form
Designer, Solution Explorer, and Properties windows are open; the Toolbox window is
auto-hidden.
To reset the
window layout
in the IDE, click
Window on the
menu bar, click
Reset Window Layout,
and then click the Yes
button.
Alphabetical button
In the next several sections, you will take a closer look at the Windows Form Designer, Solution
Explorer, and Properties windows. (The Toolbox window is covered in Lesson B.)
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
16
CHAPTER 1 An Introduction to Visual Basic 2015
title bar
form
Recall that As you learned in the Overview, all objects in an object-oriented program are instantiated
a class is a (created) from a class. A form, for example, is an instance of the Windows Form class. The form
pattern that (an object) is automatically instantiated for you when you create a Windows application.
the computer
uses to create
an object. The Solution Explorer Window
The Solution Explorer window displays a list of the projects contained in the current solution
and the items contained in each project. Figure 1-8 shows the Solution Explorer window for
the Splash Solution, which contains one project named Splash Project. One of the items within
the project is a file named Form1.vb. The .vb extension on the filename indicates that the file is
a Visual Basic source file, which is a file that contains program instructions, called code. The
Form1.vb file contains the code associated with the form displayed in the designer window. You
can view the code using the Code Editor window, which you will learn about in Lesson B.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
17
The Splash Screen Application L E S S O N A
The Form1.vb source file is referred to as a form file because it contains the code associated
with a form. The code associated with the first form included in a project is automatically stored
in a form file named Form1.vb. The code associated with the second form in the same project
is stored in a form file named Form2.vb, and so on. Because a project can contain many forms
and, therefore, many form files, it is a good practice to give each form file a more meaningful
name. Doing this will help you keep track of the various form files in the project. You can use the
Properties window to change the filename.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
18
CHAPTER 1 An Introduction to Visual Basic 2015
Object box
Categorized
Alphabetical button
button
Properties
list Settings box
Description
pane
START H ERE To use the Properties window to change the form file’s name:
You can also 1. Form1.vb should be selected in the Solution Explorer window. Click File Name in the
change the File Properties list. Type Splash Form.vb and press Enter. (Be sure to include the .vb
Name property extension on the filename; otherwise, the computer will not recognize the file as a
by right-clicking source file.) Splash Form.vb appears in the Solution Explorer and Properties windows
Form1.vb in the and on the designer window’s tab, as shown in Figure 1-10.
Solution Explorer window
and then clicking Rename
on the context menu.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
19
Properties of a Windows Form LESSON A
1. Click the form in the designer window. Figure 1-11 shows a partial listing of the
properties of a Windows form.
location of the
Form class
form
class name
name
Figure 1-11 Properties window showing a partial listing of the form’s properties
Notice that Form1 System.Windows.Forms.Form appears in the Object box in Figure 1-11.
Form1 is the name of the form. The name is automatically assigned to the form when the form
is instantiated (created). In System.Windows.Forms.Form, Form is the name of the class used
to instantiate the form. System.Windows.Forms is the namespace that contains the Form class
definition. A class definition is a block of code that specifies (or defines) an object’s appearance
and behavior. All class definitions in Visual Basic 2015 are contained in namespaces, which you
can picture as blocks of memory cells inside the computer. Each namespace contains the code
that defines a group of related classes. The System.Windows.Forms namespace contains the
definition of the Windows Form class. It also contains the class definitions for objects you add to
a form, such as buttons and text boxes.
The period that separates each word in System.Windows.Forms.Form is called the dot member
access operator. Similar to the backslash (\) in a folder path, the dot member access operator
indicates a hierarchy, but of namespaces rather than folders. In other words, the backslash
in the path E:\VB2015\Chap01\Splash Solution\Splash Project\Splash Form.vb indicates
that the Splash Form.vb file is contained in (or is a member of ) the Splash Project folder,
which is a member of the Splash Solution folder, which is a member of the Chap01 folder, which
is a member of the VB2015 folder, which is a member of the E: drive. Likewise, the name
System.Windows.Forms.Form indicates that the Form class is a member of the Forms namespace,
which is a member of the Windows namespace, which is a member of the System namespace.
The dot member access operator allows the computer to locate the Form class in the computer’s
internal memory, similar to the way the backslash (\) allows the computer to locate the Splash
Form.vb file on your computer’s disk.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
20
CHAPTER 1 An Introduction to Visual Basic 2015
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
21
Setting and Restoring a Property’s Value LESSON A
To center a form on the screen when the application is started: STA R T HER E
1. Click StartPosition in the Properties list, click the list arrow in the Settings box, and
then click CenterScreen in the list.
1. Click Font in the Properties list and then click the … (ellipsis) button in the Settings
box to open the Font dialog box.
2. Locate and then click the Segoe UI font in the Font box. Click 9 in the Size box and
then click the OK button. (Do not be concerned if the size of the form changes.)
1. Click Size in the Properties list. The first number in the Setting box represents the
width of the form, measured in pixels. The second number represents the height, also
measured in pixels. A pixel, which is short for “picture element,” is one spot in a grid
of thousands of such spots that form an image either produced on the screen by a
computer or printed on a page by a printer.
2. Type 405, 340 and press Enter. Expand the Size property by clicking the plus box
that appears next to the property. Notice that the first number listed in the property
represents the width, and the second number represents the height. Click the minus
box to collapse the property.
1. Click BackColor in the Properties list, click the list arrow, click the Custom tab, and
then click a red square to change the background color of the form to red.
2. Right-click BackColor in the Properties list and then click Reset on the context menu.
The background color of the form returns to its default setting. Figure 1-12 shows the
status of the form in the IDE.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
22
CHAPTER 1 An Introduction to Visual Basic 2015
the asterisk
indicates that
the form has
been changed
since the last
time it was
saved
Saving a Solution
The Save All The asterisk (*) that appears on the designer tab in Figure 1-12 indicates that a change was made
button on to the form since the last time it was saved. It is a good idea to save the current solution every
the Standard 10 or 15 minutes so that you will not lose a lot of your work if a power outage unexpectedly
toolbar looks occurs. You can save the solution by clicking File on the menu bar and then clicking Save All.
like this: . You can also click the Save All button on the Standard toolbar. When you save the solution,
the computer saves any changes made to the files included in the solution. It also removes the
asterisk that appears on the designer window’s tab.
STA RT H ER E To save the current solution:
1. Click File on the menu bar and then click Save All. The asterisk is removed from the
designer window’s tab, indicating that all changes made to the form have been saved.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
23
Lesson A Summary L E S S O N A
1. Click File on the menu bar and then click Open Project to open the Open Project
dialog box.
2. Locate and then open the VB2015\Chap01\Splash Solution folder. Click Splash
Solution (Splash Solution.sln) in the list of filenames and then click the Open button.
(Depending on how Windows is set up on your computer, you may or may not see the
.sln extension on the filename. Refer to the Overview’s Summary section to learn how
to show/hide filename extensions.)
3. The Solution Explorer window indicates that the solution is open. If the designer
window is not open, right-click Splash Form.vb in the Solution Explorer window and
then click View Designer.
Lesson A Summary
•• To start Visual Studio 2015:
Tap the Windows logo key (if necessary) to switch to the Windows 8 tile-based mode and
then click the Visual Studio 2015 tile.
•• To change the default environment settings:
Click Tools, click Import and Export Settings, select the Reset all settings radio button, click
the Next button, select the appropriate radio button, click the Next button, click the settings
collection you want to use, click the Finish button, and then click the Close button to close
the Import and Export Settings Wizard dialog box.
•• To reset the window layout in the IDE:
Click Window, click Reset Window Layout, and then click the Yes button.
•• To configure Visual Studio:
Click Tools, click Options, click the Projects and Solutions node, and then use the information
shown earlier in Figure 1-3 to select and deselect the appropriate check boxes. Next, expand
the Text Editor node, expand the All Languages node, click CodeLens, and then deselect
the Enable CodeLens check box. Finally, click the Debugging node, deselect the Step over
properties and operators (Managed only) check box, deselect the Show elapsed time PerfTip
while debugging check box, and then click the OK button to close the Options dialog box.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
24
CHAPTER 1 An Introduction to Visual Basic 2015
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Random documents with unrelated
content Scribd suggests to you:
found, at a very moderate price, all that is most practical and
valuable in the former expensive edition, with a great accession
of new words and matter."—Author's Preface.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
ebookbell.com