Book contents
- Frontmatter
- Contents
- Preface
- 1 Fundamentals of Design and Programming – Starting from Scratch
- 2 Variables and Constants – A Place for Everything and Everything in Its Place
- 3 Writing Programs – First You Walk, Then You Run
- 4 Writing Programs II – More Controls and New Logic
- 5 Using If and Case – Decisions, Decisions, Decisions
- 6 Loops – Once Is Not Enough
- 7 Procedures and Functions – Divide and Conquer
- 8 Writing Programs III – Tying It All Together, So Far
- 9 File I/O – Files and Records and Fields, Oh My!
- 10 Arrays and Structures – Organizing Data
- 11 Events and More Controls – Tips and Tricks for Programming
- 12 Objects and Classes – Objects Are in a Class By Themselves
- 13 Graphics – The Visual (and Audio) Side of Visual Basic
- 14 LINQ to SQL – The World Runs on Databases
- 15 Crystal Reports – Tying Databases to Output
- Appendices
- Index
6 - Loops – Once Is Not Enough
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- 1 Fundamentals of Design and Programming – Starting from Scratch
- 2 Variables and Constants – A Place for Everything and Everything in Its Place
- 3 Writing Programs – First You Walk, Then You Run
- 4 Writing Programs II – More Controls and New Logic
- 5 Using If and Case – Decisions, Decisions, Decisions
- 6 Loops – Once Is Not Enough
- 7 Procedures and Functions – Divide and Conquer
- 8 Writing Programs III – Tying It All Together, So Far
- 9 File I/O – Files and Records and Fields, Oh My!
- 10 Arrays and Structures – Organizing Data
- 11 Events and More Controls – Tips and Tricks for Programming
- 12 Objects and Classes – Objects Are in a Class By Themselves
- 13 Graphics – The Visual (and Audio) Side of Visual Basic
- 14 LINQ to SQL – The World Runs on Databases
- 15 Crystal Reports – Tying Databases to Output
- Appendices
- Index
Summary
VB Quip
I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone.
–Bjarne StroustrupLife is filled with repetition. And every once in a while it throws you for a loop. Every day and every week has a routine. For example, chores are a series of often mundane tasks that get repeated time and again. Make your bed, take out the garbage, walk the dog, do the dishes. That's why they're chores. You've probably reduced these tasks to a series of steps and then repeated them as needed. Business is much the same. The steps to calculate the weekly pay are pretty much the same for every employee. So is the process for calculating a bill or determining a student's grade. Once you know the proper steps for a process, it's easy to repeat them. However, if you can get the computer to do these tasks, it will be much faster and cheaper. And, it would free you to do more pleasant and important tasks.
Until now, the only way for the computer to repeat these tasks was by clicking on a Button over and over. That's slow and hard and boring. This chapter covers repetition structures – in programming parlance, loops. With them, a series of commands can be repeated. Some loops run a specified number of times.
- Type
- Chapter
- Information
- Programming in Visual Basic 2010The Very Beginner's Guide, pp. 184 - 223Publisher: Cambridge University PressPrint publication year: 2010