DataTable = New db.DataTable
Object Browser
A handy tool for browsing and locating namespaces in VB is the Object Browser. Access this utility
in Visual Basic Express (VBE) or the Visual Studio IDE by selecting View ?¤Object Browser.
You??™ll see a tree view of all the referenced components in your project, as in Figure 2-1.
Figure 2-1. The Object Browser, displaying the Console class
In the Object Browser, you can see each namespace in your project as well as each type
defined in the namespace and the type members.
CHAPTER 2 n VB 2008 SYNTAX 28
Statements
Lines of code in VB are terminated with a carriage return/line feed (CRLF). Unlike C#, VB has
no logical line-termination character. A statement can only span multiple lines with a linecontinuation
character, which is an underscore preceded by a space. If you have a long
function name or statement and you want to make it more readable, just break it into multiple
lines like this example:
Function ComputeAvg(ByVal Param1 As Integer, _
ByVal Param2 As Integer) As Double
Return (Param1 + Param2) / 2
End Function
Conversely, you can put multiple statements on one line using the colon. You have probably
already seen multiple variable declarations on the same line if the variables are all the
same type:
Dim x, y, z As Integer
You can put multiple variable declarations of different types on the same line like this:
Dim x, y, z As Integer : Dim a, b, c As String
You can also write multiple statements on the same line using the colon:
x = 0 : y = 1 : z = 2
Although VB provides the ability to put multiple statements on one line, this is rarely
used, as it makes code less readable and more difficult to maintain.
Pages:
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81