You are here:About>Computing & Technology>Visual Basic> Learn VB.NET> Using Loops and Timers - Part 1
About.comVisual Basic
Newsletters & RSSEmail to a friendSubmit to Digg

Chapter 7 - Using Loops and Timers - Part 1

From Dan Mabbutt,
Your Guide to Visual Basic.
FREE Newsletter. Sign Up Now!

What good is a program that will only do something once?

While ... End While
Previous | Next >>

Chapter seven of our book, Visual Basic .NET Step by Stepis a short (just 23 pages!) but important chapter because loops and timers are the way you multiply the effect of your program by getting it to do something more than once. The calculator program mentioned in the lesson for Chapter 6 is a great example of a program that doesn't really need looping because it only does something once (that is, it performs one calculation based on key input). But most programs need to "double back" and repeat the same code. Or, perhaps execute the code at specific time intervals using the Timer control.

An example of how important loops are is the experience that people sometimes have of starting a program then discovering that the speed of your computer has suddenly slowed down to a crawl. The chances are good that the program you just started is "stuck in a loop" somehow. This chapter shows you how to do it right so that doesn't happen in the code you write.

So ... Lets get looping!

  1. What good is a program that will only do something once?
  2. Let's Get Looping!
  3. Loop Conditions - How to control when the loop stops
  4. Beyond the Book: Two New Loop Statements While ... While End and For Each loops
  5. An Example of a While ... End While Loop
  6. Debug.WriteLine - A headstart on the next chapter
  7. Conclusions about the Debug technique
  8. Beyond the Book: VB.NET Constants

Previous | Next >>

 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.