Skip to Content
Programming Visual Basic .NET, Second Edition
book

Programming Visual Basic .NET, Second Edition

by Jesse Liberty
April 2003
Intermediate to advanced
560 pages
14h 4m
English
O'Reilly Media, Inc.
Content preview from Programming Visual Basic .NET, Second Edition

Chapter 2. Getting Started: “Hello World”

It is a time-honored tradition to start a programming book with a “Hello World” program. In this chapter, we will create, compile, and run a simple “Hello World” program written in Visual Basic .NET. The analysis of this brief program will introduce key features of the Visual Basic .NET language.

Example 2-1 illustrates the fundamental elements of a very simple Visual Basic .NET program.

Example 2-1. A simple “Hello World” program in VB.NET

   Module HelloWorld
   ' every console app starts with Main
      Sub Main( )
         System.Console.WriteLine("Hello World")
      End Sub
   End Module

That is the entire program. Compiling and running it displays the words “Hello World” at the console.

Examining Your First Program

The single greatest challenge when learning to program is that you must learn everything before you can learn anything. Even this simple program uses many features of the language that will be discussed in coming chapters, including statements, methods, objects, strings, inheritance, blocks, libraries, and polymorphism.

This chapter provides a whirlwind tour of a number of these concepts. I’ll then spend the rest of the book expanding on these areas and showing how they can be applied to create .NET applications.

Each program consists of a series of statements, which are instructions to the complier. In VB.NET, as in previous versions of Visual Basic, every statement ends with a carriage return/linefeed; you create one by pressing the Enter key. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Visual Basic .NET

Programming Visual Basic .NET

Dave Grundgeiger
VB.NET Language in a Nutshell, Second Edition

VB.NET Language in a Nutshell, Second Edition

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596004389Supplemental ContentCatalog PageErrata