Skip to Content
Programming Visual Basic .NET
book

Programming Visual Basic .NET

by Dave Grundgeiger
December 2001
Beginner
464 pages
13h 51m
English
O'Reilly Media, Inc.
Content preview from Programming Visual Basic .NET

Statements

Visual Basic .NET is a line-oriented language, in which line breaks generally indicate the ends of statements. However, there are times when a programmer may wish to extend a statement over several lines or have more than one statement on a single line.

To extend a statement over several lines, use the line-continuation character, an underscore (_). It must be the last character on its line, and it must be immediately preceded by a space character. Lines connected in this way become a single logical line. Here is an example:

Dim strSql As String = "SELECT Customers.CompanyName," _
   & " COUNT(Orders.OrderID) AS OrderCount" _
   & " FROM Customers INNER JOIN Orders" _
   & " ON Customers.CustomerID = Orders.CustomerID" _
   & " GROUP BY Customers.CompanyName" _
   & " ORDER BY OrderCount DESC"

A line break can occur only where whitespace is allowed.

To place two or more statements on a single line, use the colon (:) between the statements, like this:

i = 5 : j = 10

The remainder of this section discusses the statements in Visual Basic .NET.

Option Statements

There are three Option statements, which affect the behavior of the compiler. If used, they must appear before any declarations in the same source file. They control the compilation of the source code in the file in which they appear. They are:

Option Compare

The Option Compare statement controls the manner in which strings are compared to each other. The syntax is:

Option Compare [ Binary | Text ]

If Binary is specified, strings ...

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, Second Edition

Programming Visual Basic .NET, Second Edition

Jesse Liberty

Publisher Resources

ISBN: 0596000936Supplemental ContentCatalog PageErrata