1. Home
  2. Computing & Technology
  3. Visual Basic

By , About.com Guide

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

Tutorial

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

Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2009 About.com, a part of The New York Times Company.

All rights reserved.