You are here:About>Computing & Technology>Visual Basic
About.comVisual Basic
Newsletters & RSSEmail to a friendSubmit to Digg

Chapter 5 - VB.NET Language and Syntax - Part 2

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

Examples of the Math Operators

A few examples of the use of math operators:
  • calculating the size and position of windows
  • calculating color values (see the About Visual Basic article, Calculating a Contrasting Color Code
  • calculating indexes in databases and loops

Although it's based on VB 6 rather than VB.NET, you can see how remainder division is used to calculate the row and column position in the About Visual Basic article Programming The Tic Tac Toe Game. A VB.NET version of this program is shown later in this tutorial.

If you do find yourself doing a lot of mathematical programming, you'll discover that the fundamental math functions take just too much time and code to use. Who wants to repeat the calculation of the trigonometry calculation of the square root in your code! Object Oriented Programming to the rescue! The .NET Framework includes the System.Math library so you don't have to and the book's explanation of how to use it is great!

But again, the book is just a little bit incomplete ... see why on the next page.

  1. How to use InputBox and MsgBox as the first examples of function statements
  2. "Magic" Numbers in the Code
  3. Trying Out Changes in the Book's Code
  4. Windows Form Designer Generated Code
  5. More on Numbers and VB.NET
  6. Math and Programming
  7. Examples of the Math Operators
  8. What Should Have Been Included in the Book
  9. Qualifying With System.Math
  10. The Bottom Line!

<< 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.