Instant Download Clearly Visual Basic: Programming With Microsoft Visual Basic 2010, Second Edition Diane Zak - Ebook PDF PDF All Chapters
Instant Download Clearly Visual Basic: Programming With Microsoft Visual Basic 2010, Second Edition Diane Zak - Ebook PDF PDF All Chapters
com
https://ebooksecure.com/download/clearly-visual-
basic-programming-with-microsoft-visual-
basic-2010-second-edition-ebook-pdf/
https://ebooksecure.com/download/programming-with-microsoft-visual-
basic-2017-ebook-pdf/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-introduction-to-programming-
using-visual-basic-10th-edition/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-starting-out-with-visual-
basic-8th-edition-by-tony-gaddis/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-international-relations-
theory-a-primer-2nd-edition/
ebooksecure.com
(eBook PDF) Media Literacy 9th Edition by W. James Potter
https://ebooksecure.com/product/ebook-pdf-media-literacy-9th-edition-
by-w-james-potter/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-basic-marketing-research-
with-excel-3rd-edition/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-fundamentals-of-
physics-11th-edition-by-david-halliday/
ebooksecure.com
https://ebooksecure.com/product/learning-react-modern-patterns-for-
developing-react-apps-2nd-edition-ebook-pdf/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-australian-business-
law-201635th-edition-by-paul-latimer/
ebooksecure.com
(Original PDF) Interviewing and Change Strategies for
Helpers 8th
https://ebooksecure.com/product/original-pdf-interviewing-and-change-
strategies-for-helpers-8th/
ebooksecure.com
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.
CLEARLY VISUAL BASIC®
P R O G R A M M I N G W I T H M I C R O S O F T ® V I S U A L B A S I C ® 2 01 0
This page intentionally left blank
SECOND EDITION
DIANE ZAK
Australia l Brazil l Japan l Korea l Mexico l Singapore l Spain l United Kingdom l United States
Clearly Visual Basic: ª 2012 Course Technology, Cengage Learning
Programming with Microsoft
ALL RIGHTS RESERVED. No part of this work covered by the copyright herein may be
Visual Basic 2010, Second Edition reproduced, transmitted, stored or used in any form or by any means graphic, electronic,
Diane Zak or mechanical, including but not limited to photocopying, recording, scanning, digitizing,
taping, Web distribution, information networks, or information storage and retrieval
Executive Editor: Marie Lee
systems, except as permitted under Section 107 or 108 of the 1976 United States
Acquisitions Editor: Brandi Shailer Copyright Act, without the prior written permission of the publisher.
Senior Product Manager: Alyssa Pratt
Freelance Product Manager: Tricia Coia
For product information and technology assistance, contact us at
Associate Product Manager: Cengage Learning Customer & Sales Support, 1-800-354-9706
Stephanie Lorenz
For permission to use material from this text or product,
Marketing Manager: Shanna Shelton
submit all requests online at cengage.com/permissions
Senior Content Project Manager: Jill Braiewa Further permissions questions can be emailed to
Quality Assurance: Green Pen QA permissionrequest@cengage.com
Art Director: Faith Brosnan
Cover Designer: Cabbage Design Company Library of Congress Control Number: 2011921829
Text Designer: Shawn Girsberger
ISBN 13: 978 1 111 53015 0
Print Buyer: Julio Esperas
ISBN 10: 1 111 53015 7
Proofreader: Suzanne Huizenga
Indexer: Alexandra Nickerson Course Technology
Compositor: Integra Software Services 20 Channel Center Street
Boston, MA 02210
USA
Some of the product names and company names used in this book have been used for
identification purposes only and may be trademarks or registered trademarks of their
respective manufacturers and sellers.
Course Technology, a part of Cengage Learning, reserves the right to revise this
publication and make changes from time to time in its content without notice.
Example: Microsoft® is a registered trademark of the Microsoft Corporation.
Cengage Learning is a leading provider of customized learning solutions with office
locations around the globe, including Singapore, the United Kingdom, Australia,
Mexico, Brazil, and Japan. Locate your local office at: www.cengage.com/global
Cengage Learning products are represented in Canada by Nelson Education, Ltd.
To learn more about Course Technology, visit
www.cengage.com/coursetechnology
To learn more about Cengage Learning, visit www.cengage.com
Purchase any of our products at your local college store or at our preferred online store
www.cengagebrain.com
Brief Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
C H AP T E R 1 I Am Not a Control Freak! (Control Structures) . . . . . . . . . .1
C H AP T E R 2 First You Need to Plan the Party (Problem-Solving Process) . . . 11
C H AP T E R 3 I Need a Tour Guide (Introduction to Visual Basic 2010) . . . . . 27
C H AP T E R 4 Do It Yourself Designing (Designing Interfaces) . . . . . . . . . 49
C H AP T E R 5 The Secret Code (Assignment Statements) . . . . . . . . . . . 67
C H AP T E R 6 Where Can I Store This? (Variables and Constants) . . . . . . . 81
C H AP T E R 7 What’s Wrong with It? (Syntax and Logic Errors) . . . . . . . . .101
C H AP T E R 8 Decisions, Decisions, Decisions (Selection Structure) . . . . . .115
C H AP T E R 9 Time to Leave the Nest (Nested Selection Structures) . . . . . .139
C H AP T E R 1 0 So Many Paths . . . So Little Time (Multiple-Alternative
Selection Structures) . . . . . . . . . . . . . . . . . . . .159
C H AP T E R 1 1 Testing, Testing . . . 1, 2, 3 (Selecting Test Data) . . . . . . . .183
C H AP T E R 1 2 How Long Can This Go On? (Pretest Loops) . . . . . . . . . . .203
C H AP T E R 1 3 Do It, Then Ask Permission (Posttest Loops) . . . . . . . . . .231
C H AP T E R 1 4 Let Me Count the Ways (Counter-Controlled Loops) . . . . . . .241
C H AP T E R 1 5 I’m on the Inside; You’re on the Outside (Nested Loops) . . . . .261
C H AP T E R 1 6 I Hear You Are Breaking Up (Sub Procedures) . . . . . . . . . .279
C H AP T E R 1 7 Talk to Me (Function Procedures) . . . . . . . . . . . . . . .303
C H AP T E R 1 8 A Ray of Sunshine (One-Dimensional Arrays) . . . . . . . . . .319
C H AP T E R 1 9 Parallel and Dynamic Universes (More on One-Dimensional
Arrays) . . . . . . . . . . . . . . . . . . . . . . . . . . .341
C H AP T E R 2 0 Table Tennis, Anyone? (Two-Dimensional Arrays) . . . . . . . .363
C H AP T E R 2 1 Building Your Own Structure (Structures) . . . . . . . . . . . .383
vi
CONTENTS
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Abraham Ibn Ezra explains the words “And the Lord spake to
Moses” as referring to true speech and not to speech with the mouth,
which is merely a representation of the other. “God spake to Moses”
as man speaketh to his neighbour; that is to say, directly and not
through a messenger (On Exod. xxxiii. 11).—In commenting on the
Nineteenth Psalm he says: “The first part shows how the intelligent
man can find in nature evidence for the existence and power of the
Deity; but there is a far better and more trustworthy witness: the Law,
&c, called by David ‘perfect,’ because no other evidence is required
in support of the Divine utterances contained in the Holy Writings”
(On Ps. xix. 8).—Ibn Ezra is so firm in his belief in the truth of the
Divine Writings that he sets aside the contrary opinions of men as
absurd. “We believe in the words of our God and abandon the vain
opinions of the sons of man” (On Gen. vii. 19).—Whatever message
they brought from God was true, and its realisation could be relied
upon provided that the conditions were fulfilled, which were either
expressed or implied. In other things, however, which were not
contained in the Divine message they were not infallible (On Exod.
iv. 20). The prophets were trained for the office. The sons of the
prophets (or “the disciples”) led a contemplative life of seclusion, in
the hope of receiving inspiration, every one according to his faculty
(On Exod. iii. 15). The first step in this preparation was “the training
in the fear of the Lord,” which leads man to heed the negative
precepts of the Law. Then follows “the worship of God,” which
includes the observance of all positive precepts (Yesod Mora, vii.).
The view of Maimonides, that man after due preparation and training
may still be debarred from the rank of prophet, is severely criticised
by the Commentators of the Guide. They maintain that God, after
having invited and encouraged man to approach Him, would not then
thwart [201]the very hope He had implanted. According to their
opinion, God’s hand is extended to all; every one may acquire the
prophetic faculty, and those who have not acquired it have not been
duly qualified for it. (Comp. the Comm. of Ephodi, Narboni a. o. on
“The Guide,” II., xxxii.).
The words שנבואת משה רבנו ע׳׳ה היתה אמתיתhave been wrongly
translated “that the prophecy of Moses was true,” because this is
contained in the sixth principle, which applies equally to Moses and
to all other prophets. The term אמתיתdoes here not denote “true,”
but “real,” “perfect,” or “direct;” and the difference between the Divine
inspiration of Moses and that of other prophets is expressed in the
above phrase, in accordance with the distinction made in the
Pentateuch (Num. xii. 8). It has been considered necessary [202]to
formulate this distinction between Moses and other prophets in a
separate article, because it is of great importance in the proof of the
Immutability of the Law.
Maimonides in “The Guide” (chap. xxxv.) and Mishneh torah (I.,
Hilchoth Yesode ha-torah vii. 6) fully describes the difference
between Moses and other prophets. He enumerates four points:—
(1.) Other prophets received the Divine message in a vision or a
dream, whilst Moses received it in a state of complete
consciousness, being awake, and apprehending the words like those
spoken by a man to his fellow-men. (2.) Other prophets received the
message in images, which they had first to interpret before
communicating it to their fellow-men; Moses was addressed by God
in clear words and not in figurative speech. (3.) Other prophets were
overcome by the sight, and were in a state of fear and trembling;
Moses experienced nothing of this kind. (4.) Moses was sure to
receive a Divine reply whenever he sought it; not so the other
prophets.
There are also some instances in the Talmud and the Midrashim of
Biblical quotations not in harmony with the received text. This
discrepancy is either due to the fact that preachers and expounders
quoted from memory, and may have erroneously confounded two
similar passages, or it is due to the carelessness of the copyists.
Indications of a Biblical text at variance with the received text are
found in the ancient Versions. But, with the exception of the Chaldee
Version of the Pentateuch by Onkelos, and that of [205]the Prophets
by Jonathan, we have no authorised Version, and it is uncertain how
many of the discrepancies have their origin in a corrupt text in the
hands of the translator, and how many of them are due to the error of
the translator in misreading or mistranslating the correct text before
him. By no means are these facts sufficient ground for doubting the
correctness of the received text, however plausible the suggested
emendations may appear.
The existence of the Pentateuch at the time when the other Biblical
books were written is clear from the frequent references to the
history and the laws contained in it. Such are, e.g.: “Only be thou
strong and very courageous, that thou mayest observe to do
according to all the law which Moses, my servant, commanded
thee,” &c. “This book of the law shall not depart out of thy mouth,”
&c. (Jos. i. 7, 8). “As Moses, the servant of the Lord, commanded the
children of Israel, as it is written in the book of the law of Moses,” &c.
“And he wrote there upon the stones a copy of the law of Moses
which he wrote in the presence of the children of Israel. And
afterward he read all the words of the law, the blessing and cursing,
according to all that is written in the book of the law” (Ibid. viii. 31, 32,
34). “Keep the charge of the Lord thy God, to walk in his ways, to
keep his statutes and his commandments, and his judgments, and
his testimonies, as it is written in the law of Moses,” &c. (1 Kings
[206]ii. 3). “But the children of the murderers he slew not: according
unto that which is written in the book of the law of Moses,” &c. (2
Kings xiv. 6). “Keep the passover unto the Lord your God, as it is
written in the book of the covenant” (Ibid. xxiii. 21). “Remember the
law of Moses, my servant, which I commanded unto him in Horeb for
all Israel, statutes and judgments” (Mal. iii. 16).
The authors of the other books of the Bible show familiarity with the
words, the phrases, and the contents of the Pentateuch. Thus Psalm
civ. is based on the first chapter of Genesis; the flood is mentioned in
Ps. xxix. and in the prophecies of Isaiah (liv. 9); the history of the
Patriarchs and of the Israelites in Egypt and in the wilderness in Ps.
cvi., lxxviii.; the history of Jacob is alluded to in Hosea xii.; the
destruction of Sodom and Gomorrah in Isa. i. 9, Amos iv. 11.
That in the days of the Judges, when “every man did what was right
in his eyes,” and during the reign of wicked kings many laws were
ignored or broken is not at all surprising. When the sacrifices offered
up by Samuel and Solomon are adduced as a proof that the Law,
which only allows priests to sacrifice, was not known in those days,
the argument is based on a misinterpretation of the Biblical text.
When laymen brought sacrifices, the priests performed the service
for them; the principal thing to be mentioned was in whose name or
in whose presence the sacrifice was brought; it was unnecessary to
state that the priests had to sprinkle the blood and to burn certain
portions upon the altar; no one doubted it.
Far from finding in the other books of the Bible any evidence—
whether positive or negative—of the later origin [209]of the Torah, we
feel convinced that their contents presuppose not only the existence
of the Torah, but also the authors’ familiarity with it. Without the
Torah the other books are unintelligible. There is nothing in the
Pentateuch that betrays a post-Mosaic origin. If the Pentateuch had
been written in the period of the Kings, the author would have
mentioned Jerusalem as the appointed place for the Sanctuary; in
the rebukes (תוכחה), in addition to idolatry, the social corruption
pointed out by the prophets would have been mentioned; the
restrictive law concerning the marriage of heiresses would have
been superfluous, as it only applied to the first generation that
entered Palestine.
The phrase עבר הירדןhas been quoted as a proof that the author of
the Pentateuch must have lived in Palestine, or else he could not
have called the east banks of the Jordan “the other side of Jordan;”
but this translation is wrong. The phrase only means the banks of
Jordan.
A careful study of the Hebrew Bible will show that it is not the author,
or the age of the author, but the contents of the passage that
determined which of the Divine names was to be used. The same
author repeats the same account with some variation, according to
the lesson which he intends to convey to the reader. The proofs
which are based on the differences discovered in two accounts of
apparently the same event, or on seeming contradictions or
anachronisms, are so indifferently supported that they are not able to
conquer the fortress of Faith and Tradition. The difficulties pointed
out by the critics vanish before patient study and the earnest longing
for instruction and comfort offered by the Bible.
The Book of Isaiah has likewise been subjected to the analytical test
of the critic, and it is generally believed that the prophecies
contained in the book have not all been written by the same author
or in the same age. The book is divided into two large sections; the
second section, from chap. xl. to chap, lxvi., is thought to have been
composed shortly before the return of the Jews from Babylon.
Although it is possible that anonymous prophecies were added to a
book, the reasons which induced critics to make such a division are
untenable. The first reason is the difference in style; but we must
take account of the difference in the contents of the two sections.
The prophecies in the first section have mostly a threatening
tendency with regard to imminent punishment, whilst in the second
section Israel is to be encouraged in his faith in the Almighty and in
his hopes for a better future. It is but natural that the style should not
be the same in both sections. [213]Another reason for ascribing the
second section to a later prophet is the fact that Koresh (Cyrus), king
of Persia, is mentioned by name, and the fall of Babylon and the
consequent deliverance of the Jews are described as well-known
facts of the past. This and similar arguments are based on a
misunderstanding of the character of the prophecies. The critics
ignore the essential difference between the writings of inspired
messengers of God and those of ordinary men. They deny to the
man of God the power of foreseeing and foretelling coming events of
which his fellow-men could not have any knowledge. By such
arguments the critics set limits to the power and wisdom of God, and
employ the same measure for both that which is Divine and that
which is human. A Divine prophet has, by the Will of the Almighty,
the future unrolled before him; he sees the catastrophe which is to
come centuries later, and perceives its effect and its end. Even when
he reviews the present state of affairs and takes the immediate
future into consideration, his eyes frequently behold scenes and
events of “the end of the days” (באחרית הימים), which he points out
as the goal of our hopes and aspirations. When he warns, advises,
or encourages his brethren with regard to their present wants, the
virtues and the happiness of the Messianic age are not rarely
introduced. Earlier events, though still future in time, appear then in
the light of accomplished facts, and in their description the past
tense is used instead of the future. Thus it happened that the
prophet Isaiah, who flourished during the reign of King Hezekiah,
could take his standpoint on the return of the Jews from Babylonia,
look back at the exile as a thing of the past, and reveal to his
brethren further troubles, the succeeding final redemption, and the
ultimate triumph of the faithful and God-fearing over the faithless and
wicked.
In like manner have the authenticity and the integrity of other Biblical
books been rejected; the method and the arguments are the same;
they are based on a misunderstanding of the true essence of
prophecy and inspiration, and originate in a want of belief in the
Omniscience and Omnipotence of the Divine Being.
In the Pentateuch there is not the slightest indication that the laws
revealed on Sinai might be superseded by a future Revelation. On
the contrary, we meet repeatedly with the phrases, חקת עולם, “an
everlasting statute,” לדרות עולם, “for everlasting generations,” and
similar expressions, which clearly show the intention of Him who
gave the laws that these should last for ever. The Israelites were told
that [216]Prophets would be sent to them, and that they must listen to
the Prophets and obey them, but at the same time they were
commanded to put to death a prophet who would attempt “to turn
them aside from the way which the Lord commanded them to walk
therein” (Deut. xiii. 6). Besides, the Prophets never speak of a new
Revelation, which would supersede the Torah. When Jeremiah
prophesies about a new covenant, the context teaches the reader
what is meant by the “new covenant.” He speaks of the future and
final restoration of Israel as follows: “Behold, days will come, saith
the Lord, when I shall make a new covenant with the house of Israel
and with the house of Judah. Not like the covenant which I made
with their fathers on the day when I took hold of their hand to bring
them out of the land of Egypt, because they broke my covenant, and
I rejected them, saith the Lord. But this is the covenant which I shall
make with the house of Israel after those days, saith the Lord, when I
set my Law among them and write it upon their heart: both I shall be
to them a God, and they shall be to me a people” (Jer. xxxi. 31–33).
The Law is not to be altered, but it will dwell more firmly in the heart
of Israel; the deliverance from Egypt was soon forgotten, but the
future deliverance will plant the fear and love of God—here called
the Law of God—in the hearts of the people in such a manner that it
will take a deep root and will not be plucked out of it again. There