Writing Code in Visual Basic .NET


Web Matrix supports code in two languages; Visual Basic .NET and C#. For this book, we've chosen to use Visual Basic .NET because Visual Basic .NET has a verbose and easy-to-read syntax that makes it a good choice for a beginner to programming.

Visual Basic .NET can also be used for more than simple web programming. The great news is that after you've read the next few chapters, you'll be a long way into learning Visual Basic .NET – a language that you can use for writing all sorts of programs.

The other great news is that you've already seen some Visual Basic .NET code in action, so it won't be completely new to you. In this chapter, we will expand on the outline knowledge that you gained in the first few chapters of this book, and you'll see how to write Visual Basic .NET code for yourself.

In order to prepare you for the contents of this chapter, we need to say a few words about data types and the types that we will be using in this chapter. By data type, we are referring to the type of data that can be stored by a variable or object. We'll be learning a lot more about these concepts in the next chapter, but to better understand the contents of this chapter, you will need to understand what the following two types of data are:

  • A String is used to store textual data, information like a name, a word, or anything that is represented by a series of characters

  • An Integer is a whole number, for example, 3, 68, or 254, which we can use for counting, or for arithmetic calculation

We can convert from one type to a different type for instance, we will occasionally want to write out a number into a sentence, so we will stop treating it as a number, and write it out as a String instead. Sometimes we want to take a number entered by a user in a text box (which means it will be a string value by default), and add it to another number, as we did in our dice game. In this case, we need to treat it as an Integer.




Beginning Dynamic Websites with ASP. NET Web Matrix
Beginning Dynamic Websites: with ASP.NET Web Matrix (Programmer to Programmer)
ISBN: 0764543741
EAN: 2147483647
Year: 2003
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net