VB .NET Language in a Nutshell

Book description

The extensive changes to Visual Basic and the newness of the .NET platform call for a VB .NET reference guide oriented toward professional developers--those deeply experienced in Visual Basic and those adding VB .NET to their list of mastered languages. VB .NET Language in a Nutshell answers the call. As a reference book, it doesn't waste space on simple concepts, but documents, using practical examples, how language elements work, alternative approaches, optimal usage, and potential pitfalls. As a quick introduction, the first section of VB .NET Language in a Nutshell leads you through the important areas of programming VB .NET, including:

  • Variables and Data Types

  • Introduction to Object Oriented Programming

  • The .NET Framework: General Concepts

  • The .NET Framework Class Library

  • Delegates and Events

  • Error Handling

  • What's New and Different in VB .NET

  • Language Elements by category

  • Operators

  • Constants and Enumerations

  • The VB .NET Command Line Compiler

  • VB 6 Language Elements Not Supported by VB .NET

The meat of the book is the alphabetical reference to the functions, statements, directives, objects, and object members that make up the VB .NET language. As an experienced developer, you can quickly get the whole story on a language element that interests you or seems to be behaving unexpectedly in your code. To ease your transition to .NET, there's a "VB .NET/VB 6 Differences" section for each language element. A hefty appendix section includes:

No matter how much experience you have programming with VB, this is the kind of book you'll want to have close by, both as your standard reference guide and as a tool for troubleshooting and identifying programming problems.

Table of contents

  1. VB .NET Language in a Nutshell
    1. Preface
      1. Why Another VB Book?
      2. Who This Book Is For
        1. Readers New to Visual Basic
        2. VB and VBScript Developers New to VB .NET
        3. Existing VB .NET Developers
      3. How This Book Is Structured
        1. The Format of the Language Reference
      4. Conventions Used in This Book
      5. How to Contact Us
      6. Acknowledgments
    2. I. The Basics
      1. 1. Introduction
        1. Why VB .NET?
        2. What Is VB .NET?
          1. Object Orientation
          2. A Common Type System
          3. Access to System Services: The Framework Class Library
          4. A Common Runtime Environment
        3. What Can You Do with VB .NET?
      2. 2. Variables and Data Types
        1. Variables
          1. Variable Scope
            1. Local variables: block-level and procedure-level scope
            2. Module-level and project-level scope
              1. Private access
              2. Friend access
              3. Public access
          2. Variable Lifetime
            1. Static variables
        2. Declaring Variables and Constants
        3. Data Types
          1. Value and Reference Types
          2. VB Data Types: A Summary
          3. Simple Data Types in Visual Basic
            1. Boolean data type
            2. Byte data type
            3. Char data type
            4. Date data type
            5. Decimal data type
            6. Double data type
            7. Integer data type
            8. Long data type
            9. Object data type
            10. Short data type
            11. Single data type
            12. String data type
            13. Structure data type: user-defined types
          4. Data Type Conversion
        4. Arrays
          1. Definition of Array
          2. Dimension of an Array
          3. Size of an Array
          4. Arrays in VB .NET
            1. Redimensioning arrays
        5. Object Variables and Their Binding
          1. Late Binding Versus Early Binding
        6. The Collection Object
        7. Parameters and Arguments
          1. Passing Arguments
          2. Passing Objects
          3. Optional Arguments
          4. ParamArray
      3. 3. Introduction to Object-Oriented Programming
        1. Why Learn Object-Oriented Techniques?
        2. Principles of Object-Oriented Programming
          1. Abstraction
          2. Encapsulation
          3. Interfaces
        3. Classes and Objects
          1. Class Modules in VB .NET
          2. Class Members
          3. The Public Interface of a VB .NET Class
          4. Objects
          5. Properties
          6. Instance and Shared Members
          7. Class Constructors
          8. Finalize, Dispose, and Garbage Collection
        4. Inheritance
          1. Permission to Inherit
          2. Overriding
          3. Rules of Inheritance
          4. MyBase, MyClass, and Me
        5. Interfaces, Abstract Members, and Classes
          1. Interfaces Revisited
        6. Polymorphism and Overloading
          1. Overloading
          2. Polymorphism
        7. Scope and Accessibility in Class Modules
      4. 4. The .NET Framework: General Concepts
        1. Namespaces
        2. Common Language Runtime (CLR), Managed Code, and Managed Data
        3. Managed Execution
        4. Assemblies
        5. Assemblies and VB .NET
      5. 5. The .NET Framework Class Library
        1. The System Namespace
          1. Data Type Conversion
          2. The Array Class
          3. The Math Class
          4. The String Class
        2. Other Namespaces
          1. System.Collections
          2. System.Data
          3. System.IO
          4. System.Text.RegularExpressions
          5. System.Windows.Forms
      6. 6. Delegates and Events
        1. Delegates
          1. Using a Delegate to Call a Method
          2. Using a Delegate as a Function Pointer
        2. Events and Event Binding
          1. Control-Related Events
          2. WithEvents
          3. AddHandler
      7. 7. Error Handling in VB .NET
        1. Error Detection and Error Handling
        2. Runtime Error Handling
          1. Unstructured Error Handling
            1. The Err object
            2. Dealing with runtime errors
              1. In-line error handling
              2. Centralized error handling
              3. No enabled error-handler
          2. Structured Exception Handling
            1. Try...Catch...Finally
            2. Exception classes
        3. Dealing with Logical Errors
          1. Detecting Logical Errors
          2. Where to Handle a Logical Error
            1. Handling the error on the spot
            2. Handling the error in the offending procedure’s error handler
            3. Passing the error to the calling procedure
        4. Error Constants
    3. II. Reference
      1. 8. The Language Reference
        1. #Const Directive
        2. #If...Then...#Else Directive
        3. #Region...#End Region Directive
        4. Abs Function
        5. Acos Function
        6. AddHandler Statement
        7. AddressOf Operator
        8. AppActivate Procedure
        9. Application Class
        10. Application.CompanyName Property
        11. Application.DoEvents Method
        12. Application.ExecutablePath Property
        13. Application.ProductName Property
        14. Application.ProductVersion Property
        15. Array Class
        16. Array.BinarySearch Method
        17. Array.Copy Method
        18. Array.IndexOf Method
        19. Array.LastIndexOf Method
        20. Array.Reverse Method
        21. Array.Sort Method
        22. Asc, AscW Functions
        23. Asin Function
        24. Atan Function
        25. Atan2 Function
        26. Beep Procedure
        27. Call Statement
        28. CallByName Function
        29. CBool Function
        30. CByte Function
        31. CChar Function
        32. CDate Function
        33. CDbl Function
        34. CDec Function
        35. Ceiling Function
        36. ChDir Procedure
        37. ChDrive Procedure
        38. Choose Function
        39. Chr, ChrW Functions
        40. CInt Function
        41. Class Statement
        42. Clipboard Class
        43. Clipboard.GetDataObject Method
        44. Clipboard.SetDataObject Method
        45. CLng Function
        46. CObj Function
        47. Collection Class
        48. Collection.Add Method
        49. Collection.Count Property
        50. Collection.Item Method
        51. Collection.Remove Method
        52. ColorDialog Class
        53. Command Function
        54. Const Statement
        55. Cos Function
        56. Cosh Function
        57. CreateObject Function
        58. CShort Function
        59. CSng Function
        60. CStr Function
        61. CType Function
        62. CurDir Function
        63. DateAdd Function
        64. DateDiff Function
        65. DatePart Function
        66. DateSerial Function
        67. DateString Property
        68. DateValue Function
        69. Day Function
        70. DDB Function
        71. Debug Class
        72. Debug.Assert Method
        73. Debug.AutoFlush Property
        74. Debug.Close Method
        75. Debug.Flush Method
        76. Debug.Indent Method
        77. Debug.IndentLevel Property
        78. Debug.IndentSize Property
        79. Debug.Listeners Property
        80. Debug.Unindent Method
        81. Debug.Write Method
        82. Debug.WriteIf Method
        83. Debug.WriteLine Method
        84. Debug.WriteLineIf Method
        85. Declare Statement
        86. Delegate Statement
        87. DeleteSetting Procedure
        88. Dim Statement
        89. Dir Function
        90. Directory Class
        91. Directory.CreateDirectory Method
        92. Directory.Delete Method
        93. Directory.Exists Method
        94. Directory.GetCreationTime Method
        95. Directory.GetDirectories Method
        96. Directory.GetDirectoryRoot Method
        97. Directory.GetFiles Method
        98. Directory.GetFileSystemEntries Method
        99. Directory.GetLogicalDrives Method
        100. Directory.GetParent Method
        101. Directory.Move Method
        102. Do...Loop Statement
        103. E Field
        104. End→Statement
        105. Enum Statement
        106. Environ Function
        107. EOF Function
        108. Erase Statement
        109. Erl Property
        110. Err Object
        111. Err.Clear Method
        112. Err.Description Property
        113. Err.GetException Method
        114. Err.HelpContext Property
        115. Err.HelpFile Property
        116. Err.LastDLLError Property
        117. Err.Number Property
        118. Err.Raise Method
        119. Err.Source Property
        120. Error Statement
        121. ErrorToString Function
        122. Event Statement
        123. Exception Class
        124. Exit Statement
        125. Exp Function
        126. File Class
        127. File.Exists Method
        128. FileAttr Function
        129. FileClose Procedure
        130. FileCopy Procedure
        131. FileDateTime Function
        132. FileGet, FileGetObject Procedures
        133. FileLen Function
        134. FileOpen Procedure
        135. FilePut, FilePutObject Procedures
        136. FileWidth Procedure
        137. Filter Function
        138. Fix Function
        139. Floor Function
        140. FontDialog Class
        141. For...Next Statement
        142. For Each...Next Statement
        143. Format Function
        144. FormatCurrency, FormatNumber, FormatPercent Functions
        145. FormatDateTime Function
        146. FreeFile Function
        147. Friend Keyword
        148. Function Statement
        149. FV Function
        150. Get Statement
        151. GetAllSettings Function
        152. GetAttr Function
        153. GetChar Function
        154. GetObject Function
        155. GetSetting Function
        156. GetTimer Function
        157. GoTo Statement
        158. Handles Keyword
        159. Hashtable Class
        160. Hashtable.Add Method
        161. Hashtable.Clear Method
        162. Hashtable.ContainsKey Method
        163. Hashtable.ContainsValue Method
        164. Hashtable.CopyTo Method
        165. Hashtable.Count Property
        166. Hashtable.Item Property
        167. Hashtable.Keys Property
        168. Hashtable.Remove Method
        169. Hashtable.Values Property
        170. Hex Function
        171. Hour Function
        172. IDataObject Interface
        173. IDataObject.GetData Method
        174. IDataObject.GetDataPresent Method
        175. IDataObject.GetFormats Method
        176. IEEERemainder Function
        177. If...Then...Else Statement
        178. IIf Function
        179. Implements Keyword
        180. Implements Statement
        181. Imports Statement
        182. Inherits Statement
        183. Input Procedure
        184. InputBox Function
        185. InputString Function
        186. InStr Function
        187. InStrRev Function
        188. Int Function
        189. Interface Statement
        190. IPmt Function
        191. IRR Function
        192. Is Operator
        193. IsArray Function
        194. IsDate Function
        195. IsDBNull Function
        196. IsError Function
        197. IsNothing Function
        198. IsNumeric Function
        199. IsReference Function
        200. Join Function
        201. Kill Procedure
        202. LBound Function
        203. LCase Function
        204. Left Function
        205. Len Function
        206. Like Operator
        207. LineInput Function
        208. Loc Function
        209. Lock Procedure
        210. LOF Function
        211. Log Function
        212. Log10 Function
        213. LTrim Function
        214. Max Function
        215. Me Operator
        216. Mid Function
        217. Mid Statement
        218. Min Function
        219. Minute Function
        220. MIRR Function
        221. MkDir Procedure
        222. Mod Operator
        223. Module...End Module Statement
        224. Month Function
        225. MonthName Function
        226. MsgBox Function
        227. MyBase Keyword
        228. MyClass Keyword
        229. Namespace Statement
        230. Now Property
        231. NPer Function
        232. NPV Function
        233. Oct Function
        234. On Error Statement
        235. OpenFileDialog Class
        236. Option Compare Statement
        237. Option Explicit Statement
        238. Option Strict Statement
        239. Partition Function
        240. Pi Field
        241. Pmt Function
        242. Pow Function
        243. PPmt Function
        244. Print, PrintLine Procedures
        245. Private Statement
        246. Property Statement
        247. Protected Keyword
        248. Public Statement
        249. PV Function
        250. QBColor Function
        251. Queue Class
        252. Queue.Clear Method
        253. Queue.Contains Method
        254. Queue.CopyTo Method
        255. Queue.Count Property
        256. Queue.Dequeue Method
        257. Queue.Enqueue Method
        258. Queue.Peek Method
        259. Queue.ToArray Method
        260. RaiseEvent Statement
        261. Randomize Procedure
        262. Rate Function
        263. ReDim Statement
        264. Rem Statement
        265. Rename Procedure
        266. Replace Function
        267. Reset Procedure
        268. Resume Statement
        269. Return Statement
        270. RGB Function
        271. Right Function
        272. RmDir Procedure
        273. Rnd Function
        274. Round Function
        275. RTrim Function
        276. SaveFileDialog Class
        277. SaveSetting Procedure
        278. ScriptEngine Function
        279. ScriptEngineBuildVersion Function
        280. ScriptEngineMajorVersion Function
        281. ScriptEngineMinorVersion Function
        282. Second Function
        283. Seek Function
        284. Seek Procedure
        285. Select Case Statement
        286. Send, SendWait Methods
        287. Set Statement
        288. SetAttr Procedure
        289. Shadows Keyword
        290. Shell Function
        291. Sign Function
        292. Sin Function
        293. Sinh Function
        294. SLN Function
        295. Space Function
        296. Spc Function
        297. Split Function
        298. Sqrt Function
        299. Stack Class
        300. Stack.Clear Method
        301. Stack.Contains Method
        302. Stack.CopyTo Method
        303. Stack.Count Property
        304. Stack.Peek Method
        305. Stack.Pop Method
        306. Stack.Push Method
        307. Stack.ToArray Method
        308. Static Statement
        309. Stop Statement
        310. Str Function
        311. StrComp Function
        312. StrConv Function
        313. StrDup Function
        314. StrReverse Function
        315. Structure...End Structure Statement
        316. Sub Statement
        317. Switch Function
        318. SYD Function
        319. SyncLock Statement
        320. SystemTypeName Function
        321. Tab Function
        322. Tan Function
        323. Tanh Function
        324. Throw Statement
        325. TimeOfDay Property
        326. Timer Property
        327. TimeSerial Function
        328. TimeString Property
        329. TimeValue Function
        330. Today Property
        331. Trim Function
        332. Try...Catch...Finally Statement
        333. TypeName Function
        334. UBound Function
        335. UCase Function
        336. Unlock Procedure
        337. Val Function
        338. ValDec Function
        339. VarType Function
        340. VbTypeName Function
        341. Weekday Function
        342. WeekdayName Function
        343. While...End While Statement
        344. With Statement
        345. WithEvents Keyword
        346. Write Procedure
        347. WriteLine Procedure
        348. Year Function
    4. III. Appendixes
      1. A. What’s New and Different in VB .NET
        1. Language Changes for VB .NET
          1. Data Types
            1. Strings
            2. Integer/Long data type changes
            3. Variant data type
            4. Other data type changes
          2. Variables and Their Declaration
            1. Variable declaration
            2. Variable initialization
            3. Variable scope changes
            4. Arrays and array declarations
            5. Structure/user-defined type declarations
          3. Boolean and Bitwise Operators
          4. Changes Related to Procedures
            1. Calling a procedure
            2. Default Method of Passing Arguments
            3. Optional arguments
            4. Return statement
            5. Passing property parameters in procedures
            6. ParamArray parameters
          5. Miscellaneous Language Changes
            1. Line numbers
            2. On GoTo
            3. While
            4. GoSub and Return statements
        2. Changes to Programming Elements
          1. Constants
          2. String Functions
          3. Emptiness
          4. Graphical Functionality
          5. Mathematical Functionality
          6. Diagnostics
          7. Miscellaneous
        3. Obsolete Programming Elements
        4. Structured Exception Handling
        5. Changes in Object-Orientation
          1. Inheritance
          2. Overloading
          3. Object Creation
          4. Properties
            1. Default properties
            2. Property declarations
      2. B. Language Elements by Category
        1. Array Handling
        2. Clipboard
        3. Collection Objects
        4. Common Dialogs
        5. Conditional Compilation
        6. Conversion
          1. Data Type Conversion
          2. Other Conversion
        7. Date and Time
        8. Debugging
        9. Declaration
        10. Error Handling
        11. Filesystem
        12. Financial
        13. IDataObject Interface
        14. Information
        15. Input/Output
        16. Integrated Development Environment
        17. Interaction
        18. Mathematics
        19. Program Structure and Flow
        20. Programming
          1. Object Programming
          2. Miscellaneous Programming
        21. Registry
        22. String Manipulation
      3. C. Operators
        1. Arithmetic Operators
        2. Assignment Operators
        3. Concatenation Operators
        4. Comparison Operators
          1. The Is Operator
          2. The Like Operator
        5. Logical and Bitwise Operators
        6. Operator Precedence
      4. D. Constants and Enumerations
        1. Visual Basic Intrinsic Constants
        2. ControlChars Class
        3. Visual Basic Enumerations
          1. AppWinStyle Enumeration
          2. CallType Enumeration
          3. CompareMethod Enumeration
          4. DateFormat Enumeration
          5. DateInterval Enumeration
          6. DueDate Enumeration
          7. FileAttribute Enumeration
          8. FirstDayOfWeek Enumeration
          9. FirstWeekOfYear Enumeration
          10. MsgBoxResult Enumeration
          11. MsgBoxStyle Enumeration
          12. OpenAccess Enumeration
          13. OpenMode Enumeration
          14. OpenModeTypes Enumeration
          15. OpenShare Enumeration
          16. PrintFlags Enumeration
          17. TriState Enumeration
          18. VariantType Enumeration
          19. VbStrConv Enumeration
      5. E. The VB .NET Command-Line Compiler
        1. Compiler Basics
        2. Command-Line Switches
          1. Output Filename and File Type
          2. Input Files
          3. Resources
          4. Code Generation
          5. Debugging
          6. Errors and Warnings
          7. Language
          8. Miscellaneous
          9. Advanced
        3. Using a Response File
      6. F. VB 6 Language Elements Not Supported by VB .NET
    5. Index
    6. Colophon

Product information

  • Title: VB .NET Language in a Nutshell
  • Author(s): Steven Roman PhD
  • Release date: August 2001
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596000929