Microsoft® Visual Basic® .NET Programmer's Cookbook

Book description

Filled with the ingredients developers need—code samples, instructions, and solutions to common problems—this book is the logical place for developers to start building projects and learning more about Visual Basic .NET.

Table of contents

  1. Microsoft Visual Basic® .Net Programmer’s Cookbook
    1. Acknowledgments
    2. Introduction
      1. Feedback
      2. Code Samples
      3. System Requirements
      4. Variable Naming
      5. Other Books
      6. Microsoft Press Support
    3. 1. Strings and Regular Expressions
      1. 1.1. Combine Strings
        1. Problem
        2. Solution
        3. Discussion
      2. 1.2. Retrieve a Portion of a String
        1. Problem
        2. Solution
        3. Discussion
      3. 1.3. Create a String Consisting of a Repeated Character
        1. Problem
        2. Solution
        3. Discussion
      4. 1.4. Change the Case of All Characters in a String
        1. Problem
        2. Solution
        3. Discussion
      5. 1.5. Perform Case-Insensitive String Comparisons
        1. Problem
        2. Solution
        3. Discussion
      6. 1.6. Iterate Over All the Characters in a String
        1. Problem
        2. Solution
        3. Discussion
      7. 1.7. Parse a String Into Words
        1. Problem
        2. Solution
        3. Discussion
      8. 1.8. Find All Occurrences of Specific Text in a String
        1. Problem
        2. Solution
        3. Discussion
      9. 1.9. Replace All Occurrences of Specific Text in a String
        1. Problem
        2. Solution
        3. Discussion
      10. 1.10. Pad a String for Fixed-Width Display
        1. Problem
        2. Solution
        3. Discussion
      11. 1.11. Reverse a String
        1. Problem
        2. Solution
        3. Discussion
      12. 1.12. Insert a New Line in a String
        1. Problem
        2. Solution
        3. Discussion
      13. 1.13. Insert a Special Character in a String
        1. Problem
        2. Solution
        3. Discussion
      14. 1.14. Manipulate Strings Quickly with StringBuilder
        1. Problem
        2. Solution
        3. Discussion
      15. 1.15. Convert a String into a Byte Array
        1. Problem
        2. Solution
        3. Discussion
      16. 1.16. Get a String Representation of a Byte Array
        1. Problem
        2. Solution
        3. Discussion
      17. 1.17. Use Common Regular Expressions
        1. Problem
        2. Solution
        3. Discussion
      18. 1.18. Validate Input with a Regular Expression
        1. Problem
        2. Solution
        3. Discussion
      19. 1.19. Find All Occurrences of a Pattern in a String
        1. Problem
        2. Solution
        3. Discussion
      20. 1.20. Replace All Occurrences of a Pattern in a String
        1. Problem
        2. Solution
        3. Discussion
      21. 1.21. Manipulate a Filename
        1. Problem
        2. Solution
        3. Discussion
      22. 1.22. Manipulate a URI
        1. Problem
        2. Solution
        3. Discussion
      23. 1.23. Validate a Credit Card with Luhn’s Algorithm
        1. Problem
        2. Solution
        3. Discussion
      24. 1.24. Validate an ISBN
        1. Problem
        2. Solution
        3. Discussion
      25. 1.25. Perform a SoundEx String Comparison
        1. Problem
        2. Solution
        3. Discussion
    4. 2. Numbers, Dates, and Other Data Types
      1. 2.1. Perform Mathematical and Trigonometric Operations
        1. Problem
        2. Solution
        3. Discussion
      2. 2.2. Convert a Number into a Formatted String
        1. Problem
        2. Solution
        3. Discussion
      3. 2.3. Generate a Random Number
        1. Problem
        2. Solution
        3. Discussion
      4. 2.4. Work with Non–Base 10 Number Systems
        1. Problem
        2. Solution
        3. Discussion
      5. 2.5. Work with Complex Numbers
        1. Problem
        2. Solution
        3. Discussion
      6. 2.6. Work with Vectors
        1. Problem
        2. Solution
        3. Discussion
      7. 2.7. Work with Matrixes
        1. Problem
        2. Solution
        3. Discussion
      8. 2.8. Work with Fractions Without Using Decimals
        1. Problem
        2. Solution
        3. Discussion
      9. 2.9. Evaluate a String Expression
        1. Problem
        2. Solution
        3. Discussion
      10. 2.10. Get the System Date and Time
        1. Problem
        2. Solution
        3. Discussion
      11. 2.11. Add and Subtract Dates and Times
        1. Problem
        2. Solution
        3. Discussion
      12. 2.12. Determine Days of the Week, Leap Years, and More
        1. Problem
        2. Solution
        3. Discussion
      13. 2.13. Get Day and Month Names in Other Languages
        1. Problem
        2. Solution
        3. Discussion
      14. 2.14. Format a Date
        1. Problem
        2. Solution
        3. Discussion
      15. 2.15. Generate a Culture-Invariant Date String
        1. Problem
        2. Solution
        3. Discussion
      16. 2.16. Validate a User-Supplied Date
        1. Problem
        2. Solution
        3. Discussion
      17. 2.17. Generate a GUID
        1. Problem
        2. Solution
        3. Discussion
      18. 2.18. Convert Basic Types to Binary
        1. Problem
        2. Solution
        3. Discussion
      19. 2.19. Test Byte Arrays for Equality
        1. Problem
        2. Solution
        3. Discussion
      20. 2.20. Convert the Name of an Enumerated Value into the Value
        1. Problem
        2. Solution
        3. Discussion
    5. 3. Arrays and Collections
      1. 3.1. Create and Populate an Array in One Step
        1. Problem
        2. Solution
        3. Discussion
      2. 3.2. Resize an Array
        1. Problem
        2. Solution
        3. Discussion
      3. 3.3. Create an Array That Is Not Bounded at Zero
        1. Problem
        2. Solution
        3. Discussion
      4. 3.4. Create a Jagged Array
        1. Problem
        2. Solution
        3. Discussion
      5. 3.5. Use a Dynamic ArrayList
        1. Problem
        2. Solution
        3. Discussion
      6. 3.6. Fill an ArrayList from an Array
        1. Problem
        2. Solution
        3. Discussion
      7. 3.7. Convert an ArrayList to an Array
        1. Problem
        2. Solution
        3. Discussion
      8. 3.8. Sort Items in an Array or ArrayList
        1. Problem
        2. Solution
        3. Discussion
      9. 3.9. Sort Non-Comparable Items in an Array or ArrayList
        1. Problem
        2. Solution
        3. Discussion
      10. 3.10. Use a Hashtable Instead of a Generic Collection
        1. Problem
        2. Solution
        3. Discussion
      11. 3.11. Enumerate Items in a Hashtable
        1. Problem
        2. Solution
        3. Discussion
      12. 3.12. Use a Queue (FIFO Collection)
        1. Problem
        2. Solution
        3. Discussion
      13. 3.13. Use a Stack (LIFO Collection)
        1. Problem
        2. Solution
        3. Discussion
      14. 3.14. Use a Sorted List
        1. Problem
        2. Solution
        3. Discussion
      15. 3.15. Create Shallow and Deep Copies of a Collection or Array
        1. Problem
        2. Solution
        3. Discussion
      16. 3.16. Create a Strongly Typed Collection
        1. Problem
        2. Solution
        3. Discussion
      17. 3.17. Create a Strongly Typed Dictionary Collection
        1. Problem
        2. Solution
        3. Discussion
      18. 3.18. Remove Items While Iterating Through a Collection
        1. Problem
        2. Solution
        3. Discussion
      19. 3.19. Iterate Through Collection Items in Random Order
        1. Problem
        2. Solution
        3. Discussion
    6. 4. Objects, Interfaces, and Patterns
      1. 4.1. Create a Value Type
        1. Problem
        2. Solution
        3. Discussion
      2. 4.2. Create a Cloneable Object
        1. Problem
        2. Solution
        3. Discussion
      3. 4.3. Create a Type-Safe Clone Method
        1. Problem
        2. Solution
        3. Discussion
      4. 4.4. Create a Comparable Object
        1. Problem
        2. Solution
        3. Discussion
      5. 4.5. Create a Disposable Object
        1. Problem
        2. Solution
        3. Discussion
      6. 4.6. Create an Object That Can Appear in the Component Tray
        1. Problem
        2. Solution
        3. Discussion
      7. 4.7. Create a Convertible Object
        1. Problem
        2. Solution
        3. Discussion
      8. 4.8. Create a Serializable Object
        1. Problem
        2. Solution
        3. Discussion
      9. 4.9. Serialize an Object to Disk
        1. Problem
        2. Solution
        3. Discussion
      10. 4.10. Clone a Serializable Object
        1. Problem
        2. Solution
        3. Discussion
      11. 4.11. Serialize Public Members of a Nonserializable Object
        1. Problem
        2. Solution
        3. Discussion
      12. 4.12. Perform Selective Serialization with the Memento Pattern
        1. Problem
        2. Solution
        3. Discussion
      13. 4.13. Throw a Custom Exception
        1. Problem
        2. Solution
        3. Discussion
      14. 4.14. Raise a Custom Event
        1. Problem
        2. Solution
        3. Discussion
      15. 4.15. Use the Singleton Pattern
        1. Problem
        2. Solution
        3. Discussion
      16. 4.16. Use the Factory Pattern
        1. Problem
        2. Solution
        3. Discussion
      17. 4.17. Use the Registry Pattern
        1. Problem
        2. Solution
        3. Discussion
      18. 4.18. Use the Lazy Initialization Pattern
        1. Problem
        2. Solution
        3. Discussion
    7. 5. Files and Directories
      1. 5.1. Manipulate a File
        1. Problem
        2. Solution
        3. Discussion
      2. 5.2. Manipulate a Directory
        1. Problem
        2. Solution
        3. Discussion
      3. 5.3. Retrieve File Version Information
        1. Problem
        2. Solution
        3. Discussion
      4. 5.4. Use Bitwise Arithmetic with File Attributes
        1. Problem
        2. Solution
        3. Discussion
      5. 5.5. Read to and Write from a Binary File
        1. Problem
        2. Solution
        3. Discussion
      6. 5.6. Filter Files with Wildcards
        1. Problem
        2. Solution
        3. Discussion
      7. 5.7. Process Files Recursively
        1. Problem
        2. Solution
        3. Discussion
      8. 5.8. Search for a File with Specific Text
        1. Problem
        2. Solution
        3. Discussion
      9. 5.9. Fill a TreeView with a Just-In-Time Directory Tree
        1. Problem
        2. Solution
        3. Discussion
      10. 5.10. Test Two Files for Equality
        1. Problem
        2. Solution
        3. Discussion
      11. 5.11. Monitor the File System for Changes
        1. Problem
        2. Solution
        3. Discussion
      12. 5.12. Create a Temporary File
        1. Problem
        2. Solution
        3. Discussion
      13. 5.13. Get the Executable Path
        1. Problem
        2. Solution
        3. Discussion
      14. 5.14. Set the Current Working Path
        1. Problem
        2. Solution
        3. Discussion
      15. 5.15. Use an Isolated Store
        1. Problem
        2. Solution
        3. Discussion
      16. 5.16. Read Application Configuration Settings
        1. Problem
        2. Solution
        3. Discussion
      17. 5.17. Create Custom Configuration Sections
        1. Problem
        2. Solution
        3. Discussion
      18. 5.18. Read Header Information from MP3 Files
        1. Problem
        2. Solution
        3. Discussion
      19. 5.19. Get Started with ZIP Files
        1. Problem
        2. Solution
        3. Discussion
      20. 5.20. Get Started with PDF Files
        1. Problem
        2. Solution
        3. Discussion
    8. 6. XML
      1. 6.1. Load an XML Document into Memory
        1. Problem
        2. Solution
        3. Discussion
      2. 6.2. Process All Nodes in a Document
        1. Problem
        2. Solution
        3. Discussion
      3. 6.3. Insert Nodes in an XML Document
        1. Problem
        2. Solution
        3. Discussion
      4. 6.4. Find Specific Elements by Name
        1. Problem
        2. Solution
        3. Discussion
      5. 6.5. Find Elements with an XPath Search
        1. Problem
        2. Solution
        3. Discussion
      6. 6.6. Load an XML Document into a Class
        1. Problem
        2. Solution
        3. Discussion
      7. 6.7. Use XML Serialization with Custom Objects
        1. Problem
        2. Solution
        3. Discussion
      8. 6.8. Perform an XSL Transform
        1. Problem
        2. Solution
        3. Discussion
      9. 6.9. Validate an XML Document Against a Schema
        1. Problem
        2. Solution
        3. Discussion
      10. 6.10. Store Binary Data with a Base64 Transform
        1. Problem
        2. Solution
        3. Discussion
    9. 7. Multithreading
      1. 7.1. Call Any Method Asynchronously with a Delegate
        1. Problem
        2. Solution
        3. Discussion
      2. 7.2. Wait for Several Asynchronous Calls to Complete
        1. Problem
        2. Solution
        3. Discussion
      3. 7.3. Wait for One of Many Asynchronous Calls to Complete
        1. Problem
        2. Solution
        3. Discussion
      4. 7.4. Use a Callback with an Asynchronous Call
        1. Problem
        2. Solution
        3. Discussion
      5. 7.5. Perform an Asynchronous Task with the Thread Class
        1. Problem
        2. Solution
        3. Discussion
      6. 7.6. Use Synchronization Code with Multiple Threads
        1. Problem
        2. Solution
        3. Discussion
      7. 7.7. Use the Thread Object with a Task That Requires Data
        1. Problem
        2. Solution
        3. Discussion
      8. 7.8. Use the Thread Object with a Task That Returns Data
        1. Problem
        2. Solution
        3. Discussion
      9. 7.9. Marshal User Interface Code to the Correct Thread
        1. Problem
        2. Solution
        3. Discussion
      10. 7.10. Stop a Thread Politely
        1. Problem
        2. Solution
        3. Discussion
      11. 7.11. Create a Thread Wrapper Class
        1. Problem
        2. Solution
        3. Discussion
      12. 7.12. Create a Reusable Task Processor
        1. Problem
        2. Solution
        3. Discussion
      13. 7.13. Use a Pool of Threads
        1. Problem
        2. Solution
        3. Discussion
    10. 8. Network Programming
      1. 8.1. Get Web Connectivity Information for the Current Computer
        1. Problem
        2. Solution
        3. Discussion
      2. 8.2. Get the IP Address of the Current Computer
        1. Problem
        2. Solution
        3. Discussion
      3. 8.3. Look Up a Host Name for an IP Address
        1. Problem
        2. Solution
        3. Discussion
      4. 8.4. Ping an IP Address
        1. Problem
        2. Solution
        3. Discussion
      5. 8.5. Download a File Using HTTP
        1. Problem
        2. Solution
        3. Discussion
      6. 8.6. Retrieve a Single Piece of Information from a Web Page
        1. Problem
        2. Solution
        3. Discussion
      7. 8.7. Find All Links in a Web Page
        1. Problem
        2. Solution
        3. Discussion
      8. 8.8. Communicate Using TCP
        1. Problem
        2. Solution
        3. Discussion
      9. 8.9. Create a Multithreaded TCP Network Server
        1. Problem
        2. Solution
        3. Discussion
      10. 8.10. Communicate Using UDP
        1. Problem
        2. Solution
        3. Discussion
      11. 8.11. Send a Broadcast Message
        1. Problem
        2. Solution
        3. Discussion
      12. 8.12. Send E-Mail Through SMTP
        1. Problem
        2. Solution
        3. Discussion
      13. 8.13. Retrieve E-Mail Through POP3
        1. Problem
        2. Solution
        3. Discussion
      14. 8.14. Access an FTP Site
        1. Problem
        2. Solution
        3. Discussion
    11. 9. Reflection
      1. 9.1. Generate a Dynamic About Box
        1. Problem
        2. Solution
        3. Discussion
      2. 9.2. List Assembly Dependencies
        1. Problem
        2. Solution
        3. Discussion
      3. 9.3. Get Type Information from a Class or an Object
        1. Problem
        2. Solution
        3. Discussion
      4. 9.4. Examine a Type for Members
        1. Problem
        2. Solution
        3. Discussion
      5. 9.5. Examine an Assembly for Types
        1. Problem
        2. Solution
        3. Discussion
      6. 9.6. Instantiate a Type by Name
        1. Problem
        2. Solution
        3. Discussion
      7. 9.7. Load an Assembly from a Remote Location
        1. Problem
        2. Solution
        3. Discussion
      8. 9.8. Invoke a Method by Name
        1. Problem
        2. Solution
        3. Discussion
      9. 9.9. Create, Apply, and Identify a Custom Attribute
        1. Problem
        2. Solution
        3. Discussion
      10. 9.10. Identify the Caller of a Procedure
        1. Problem
        2. Solution
        3. Discussion
      11. 9.11. Reflect on a WMI Class
        1. Problem
        2. Solution
        3. Discussion
      12. 9.12. Compile Source Code Programmatically
        1. Problem
        2. Solution
        3. Discussion
    12. 10. Windows Programming
      1. 10.1. Access the Registry
        1. Problem
        2. Solution
        3. Discussion
      2. 10.2. Retrieve Environment Variables
        1. Problem
        2. Solution
        3. Discussion
      3. 10.3. Handle Operating System Events
        1. Problem
        2. Solution
        3. Discussion
      4. 10.4. Access the Desktop and the Start Menu
        1. Problem
        2. Solution
        3. Discussion
      5. 10.5. Create Desktop or Start Menu Shortcuts
        1. Problem
        2. Solution
        3. Discussion
      6. 10.6. Start a Windows Application with a Main Subroutine
        1. Problem
        2. Solution
        3. Discussion
      7. 10.7. Retrieve Command-Line Parameters
        1. Problem
        2. Solution
        3. Discussion
      8. 10.8. Run the Application That Owns a File Extension
        1. Problem
        2. Solution
        3. Discussion
      9. 10.9. Find Other Running Processes
        1. Problem
        2. Solution
        3. Discussion
      10. 10.10. Terminate Another Process
        1. Problem
        2. Solution
        3. Discussion
      11. 10.11. Allow Only One Instance of Your Application to Run
        1. Problem
        2. Solution
        3. Discussion
      12. 10.12. Send Keystrokes to an Application
        1. Problem
        2. Solution
        3. Discussion
      13. 10.13. Force a Windows Shutdown or Logoff
        1. Problem
        2. Solution
        3. Discussion
      14. 10.14. Play a WAV File
        1. Problem
        2. Solution
        3. Discussion
      15. 10.15. Display the Standard Directory Selection Dialog Box
        1. Problem
        2. Solution
        3. Discussion
      16. 10.16. Use the Clipboard
        1. Problem
        2. Solution
        3. Discussion
      17. 10.17. Display Context-Sensitive Help
        1. Problem
        2. Solution
        3. Discussion
      18. 10.18. Catch Unhandled Errors
        1. Problem
        2. Solution
        3. Discussion
      19. 10.19. Create a Windows Installer Setup Project
        1. Problem
        2. Solution
        3. Discussion
      20. 10.20. Install the .NET Framework on a Client
        1. Problem
        2. Solution
        3. Discussion
      21. 10.21. Associate a File Extension with Your Application
        1. Problem
        2. Solution
        3. Discussion
    13. 11. Windows Controls
      1. 11.1. Add a Control at Runtime
        1. Problem
        2. Solution
        3. Discussion
      2. 11.2. Store Arbitrary Data in a Control
        1. Problem
        2. Solution
        3. Discussion
      3. 11.3. Replace a Control Array
        1. Problem
        2. Solution
        3. Discussion
      4. 11.4. Clear All Controls on a Form
        1. Problem
        2. Solution
        3. Discussion
      5. 11.5. Store Objects in a List
        1. Problem
        2. Solution
        3. Discussion
      6. 11.6. Force a ListBox to Scroll
        1. Problem
        2. Solution
        3. Discussion
      7. 11.7. Use a Hyperlink
        1. Problem
        2. Solution
        3. Discussion
      8. 11.8. Restrict a Text Box to Numeric Input
        1. Problem
        2. Solution
        3. Discussion
      9. 11.9. Use an Auto-Complete Combo Box
        1. Problem
        2. Solution
        3. Discussion
      10. 11.10. Sort a ListView Based on Any Column
        1. Problem
        2. Solution
        3. Discussion
      11. 11.11. Use the Drag-and-Drop Feature
        1. Problem
        2. Solution
        3. Discussion
      12. 11.12. Show a Linked Context Menu Generically
        1. Problem
        2. Solution
        3. Discussion
      13. 11.13. Use Part of the Main Menu for a Context Menu
        1. Problem
        2. Solution
        3. Discussion
      14. 11.14. Make a Multilingual Form
        1. Problem
        2. Solution
        3. Discussion
      15. 11.15. Use Form Inheritance
        1. Problem
        2. Solution
        3. Discussion
      16. 11.16. Create a Form That Can’t Be Moved
        1. Problem
        2. Solution
        3. Discussion
      17. 11.17. Make a Borderless Form Movable
        1. Problem
        2. Solution
        3. Discussion
      18. 11.18. Save the Size and Location of a Form
        1. Problem
        2. Solution
        3. Discussion
      19. 11.19. Synchronize Controls on a Form
        1. Problem
        2. Solution
        3. Discussion
      20. 11.20. Create a System Tray Application
        1. Problem
        2. Solution
        3. Discussion
      21. 11.21. Apply Windows XP Control Styles
        1. Problem
        2. Solution
        3. Discussion
    14. 12. Printing and Drawing with GDI+
      1. 12.1. Find All Installed Printers
        1. Problem
        2. Solution
        3. Discussion
      2. 12.2. Print a Simple Document
        1. Problem
        2. Solution
        3. Discussion
      3. 12.3. Print a Document That Has Multiple Pages
        1. Problem
        2. Solution
        3. Discussion
      4. 12.4. Print Centered Text
        1. Problem
        2. Solution
        3. Discussion
      5. 12.5. Print Wrapped Text
        1. Problem
        2. Solution
        3. Discussion
      6. 12.6. Print from a File
        1. Problem
        2. Solution
        3. Discussion
      7. 12.7. Display a Dynamic Print Preview
        1. Problem
        2. Solution
        3. Discussion
      8. 12.8. Retrieve Print Queue Information
        1. Problem
        2. Solution
        3. Discussion
      9. 12.9. Manage Print Jobs
        1. Problem
        2. Solution
        3. Discussion
      10. 12.10. Find All Installed Fonts
        1. Problem
        2. Solution
        3. Discussion
      11. 12.11. Convert the Format of an Image
        1. Problem
        2. Solution
        3. Discussion
      12. 12.12. Paint Static Content
        1. Problem
        2. Solution
        3. Discussion
      13. 12.13. Paint Dynamic Content
        1. Problem
        2. Solution
        3. Discussion
      14. 12.14. Use System Colors
        1. Problem
        2. Solution
        3. Discussion
      15. 12.15. Improve the Rendering Quality
        1. Problem
        2. Solution
        3. Discussion
      16. 12.16. Perform Hit Testing with Shapes
        1. Problem
        2. Solution
        3. Discussion
      17. 12.17. Draw Picture Thumbnails
        1. Problem
        2. Solution
        3. Discussion
      18. 12.18. Use Double Buffering to Increase Redraw Speed
        1. Problem
        2. Solution
        3. Discussion
      19. 12.19. Display an Irregularly Shaped Window
        1. Problem
        2. Solution
        3. Discussion
      20. 12.20. Create an Owner-Drawn Menu
        1. Problem
        2. Solution
        3. Discussion
      21. 12.21. Create an Owner-Drawn List Box
        1. Problem
        2. Solution
        3. Discussion
    15. 13. Windows Services
      1. 13.1. Use a Windows Service with a Timer
        1. Problem
        2. Solution
        3. Discussion
      2. 13.2. Use a Windows Service with a Thread
        1. Problem
        2. Solution
        3. Discussion
      3. 13.3. Create a Windows Service Installer
        1. Problem
        2. Solution
        3. Discussion
      4. 13.4. Debug a Windows Service
        1. Problem
        2. Solution
        3. Discussion
      5. 13.5. Retrieve Information About Installed Windows Services
        1. Problem
        2. Solution
        3. Discussion
      6. 13.6. Start and Stop a Windows Service Programmatically
        1. Problem
        2. Solution
        3. Discussion
      7. 13.7. Interact with Windows Services on Another Computer
        1. Problem
        2. Solution
        3. Discussion
      8. 13.8. Create a Windows Service That Uses a System Tray Icon
        1. Problem
        2. Solution
        3. Discussion
    16. 14. ADO.NET
      1. 14.1. Use Connection Pooling
        1. Problem
        2. Solution
        3. Discussion
      2. 14.2. Retrieve the Unique ID for a New Record
        1. Problem
        2. Solution
        3. Discussion
      3. 14.3. Retrieve the Unique ID for a New Record in a DataSet
        1. Problem
        2. Solution
        3. Discussion
      4. 14.4. Protect Against SQL Injection Attacks
        1. Problem
        2. Solution
        3. Discussion
      5. 14.5. Execute Multiple SQL Statements at Once
        1. Problem
        2. Solution
        3. Discussion
      6. 14.6. Use Column and Table Mappings
        1. Problem
        2. Solution
        3. Discussion
      7. 14.7. Use Last-In-Wins Concurrency with the DataAdapter
        1. Problem
        2. Solution
        3. Discussion
      8. 14.8. Optimize DataAdapter Performance with a Timestamp
        1. Problem
        2. Solution
        3. Discussion
      9. 14.9. Handle DataAdapter Concurrency Errors
        1. Problem
        2. Solution
        3. Discussion
      10. 14.10. Use a Transaction with the DataAdapter
        1. Problem
        2. Solution
        3. Discussion
      11. 14.11. Read Large Binary Fields Efficiently with a DataReader
        1. Problem
        2. Solution
        3. Discussion
      12. 14.12. Select a Subset of Data from a DataSet
        1. Problem
        2. Solution
        3. Discussion
      13. 14.13. Create a Custom Record Browser
        1. Problem
        2. Solution
        3. Discussion
      14. 14.14. Filter or Sort Data with a DataView
        1. Problem
        2. Solution
        3. Discussion
      15. 14.15. Create a Master-Details Form
        1. Problem
        2. Solution
        3. Discussion
      16. 14.16. Format Data-Bound Fields
        1. Problem
        2. Solution
        3. Discussion
      17. 14.17. Bind an Image Field to a PictureBox
        1. Problem
        2. Solution
        3. Discussion
      18. 14.18. Bind a Field to a List Control, and Restrict It to the Values from Another Table
        1. Problem
        2. Solution
        3. Discussion
      19. 14.19. Create a Calculated Column That Uses a Relationship
        1. Problem
        2. Solution
        3. Discussion
      20. 14.20. Create a Typed DataSet
        1. Problem
        2. Solution
        3. Discussion
      21. 14.21. Read an Excel File with ADO.NET
        1. Problem
        2. Solution
        3. Discussion
    17. 15. ASP.NET Web Applications
      1. 15.1. Enable Web Site Debugging
        1. Problem
        2. Solution
        3. Discussion
      2. 15.2. Store Information Between Requests
        1. Problem
        2. Solution
        3. Discussion
      3. 15.3. Add Line Breaks to a Label Control
        1. Problem
        2. Solution
        3. Discussion
      4. 15.4. Use JavaScript to Handle Key Presses, Mouse Movements, and More
        1. Problem
        2. Solution
        3. Discussion
      5. 15.5. Programmatically Set Control Focus
        1. Problem
        2. Solution
        3. Discussion
      6. 15.6. Upload a File
        1. Problem
        2. Solution
        3. Discussion
      7. 15.7. Use Custom Error Pages
        1. Problem
        2. Solution
        3. Discussion
      8. 15.8. Use Forms Authentication
        1. Problem
        2. Solution
        3. Discussion
      9. 15.9. Validate User Input
        1. Problem
        2. Solution
        3. Discussion
      10. 15.10. Use Page or Fragment Caching
        1. Problem
        2. Solution
        3. Discussion
      11. 15.11. Store Arbitrary Data in the ASP.NET Cache
        1. Problem
        2. Solution
        3. Discussion
      12. 15.12. Add Controls to a Web Form Dynamically
        1. Problem
        2. Solution
        3. Discussion
      13. 15.13. Load User Controls Programmatically
        1. Problem
        2. Solution
        3. Discussion
      14. 15.14. Dynamically Generate an Image
        1. Problem
        2. Solution
        3. Discussion
      15. 15.15. Dynamically Generate an Image on Part of a Page
        1. Problem
        2. Solution
        3. Discussion
      16. 15.16. Use the Internet Explorer Controls
        1. Problem
        2. Solution
        3. Discussion
      17. 15.17. Use a Dynamic Menu Control
        1. Problem
        2. Solution
        3. Discussion
    18. 16. Web Services
      1. 16.1. Avoid Hard-Coding the Web Service URL
        1. Problem
        2. Solution
        3. Discussion
      2. 16.2. Add Response Caching
        1. Problem
        2. Solution
        3. Discussion
      3. 16.3. Add Data Caching
        1. Problem
        2. Solution
        3. Discussion
      4. 16.4. Create a Transactional Web Method
        1. Problem
        2. Solution
        3. Discussion
      5. 16.5. Create a One-Way Web Method
        1. Problem
        2. Solution
        3. Discussion
      6. 16.6. Set Authentication Credentials for a Web Service
        1. Problem
        2. Solution
        3. Discussion
      7. 16.7. Use Session State
        1. Problem
        2. Solution
        3. Discussion
      8. 16.8. Upload or Download Large Binary Data
        1. Problem
        2. Solution
        3. Discussion
      9. 16.9. Send Out-of-Band Data in a SOAP Header
        1. Problem
        2. Solution
        3. Discussion
      10. 16.10. Trace a SOAP Message Using the SOAP Toolkit
        1. Problem
        2. Solution
        3. Discussion
      11. 16.11. Log SOAP Messages with a SOAP Extension
        1. Problem
        2. Solution
        3. Discussion
      12. 16.12. Call a Web Service from a Visual Basic 6 Client
        1. Problem
        2. Solution
        3. Discussion
    19. 17. Remoting and Enterprise Services
      1. 17.1. Make an Object Remotable
        1. Problem
        2. Solution
        3. Discussion
      2. 17.2. Register All the Remotable Classes in an Assembly
        1. Problem
        2. Solution
        3. Discussion
      3. 17.3. Host a Remote Object in IIS
        1. Problem
        2. Solution
        3. Discussion
      4. 17.4. Fire an Event over a Remoting Channel
        1. Problem
        2. Solution
        3. Discussion
      5. 17.5. Access a Remote Object Through an Interface
        1. Problem
        2. Solution
        3. Discussion
      6. 17.6. Control the Lifetime of a Remote Object
        1. Problem
        2. Solution
        3. Discussion
      7. 17.7. Use a Sponsor to Keep Remote Objects Alive
        1. Problem
        2. Solution
        3. Discussion
      8. 17.8. Control Versioning for Remote Objects
        1. Problem
        2. Solution
        3. Discussion
      9. 17.9. Use a One-Way Method
        1. Problem
        2. Solution
        3. Discussion
      10. 17.10. Track Multiple Clients with a Singleton
        1. Problem
        2. Solution
        3. Discussion
      11. 17.11. Create a COM+ Serviced Component
        1. Problem
        2. Solution
        3. Discussion
      12. 17.12. Prevent Duplicate Entries for Serviced Components
        1. Problem
        2. Solution
        3. Discussion
      13. 17.13. Create a Pooled Component
        1. Problem
        2. Solution
        3. Discussion
      14. 17.14. Use a COM+ Distributed Transaction
        1. Problem
        2. Solution
        3. Discussion
      15. 17.15. Write to the Windows Event Log
        1. Problem
        2. Solution
        3. Discussion
      16. 17.16. Find All the Message Queues on a Computer
        1. Problem
        2. Solution
        3. Discussion
      17. 17.17. Send a Custom Message Object Through Message Queuing
        1. Problem
        2. Solution
        3. Discussion
      18. 17.18. Use a Custom Performance Counter
        1. Problem
        2. Solution
        3. Discussion
    20. 18. Security and Cryptography
      1. 18.1. Retrieve Information About the Current Windows User
        1. Problem
        2. Solution
        3. Discussion
      2. 18.2. Use Windows Role-Based Security
        1. Problem
        2. Solution
        3. Discussion
      3. 18.3. Retrieve a List of All Windows Accounts or Groups
        1. Problem
        2. Solution
        3. Discussion
      4. 18.4. Log In to Another Account Programmatically
        1. Problem
        2. Solution
        3. Discussion
      5. 18.5. Impersonate the IIS User with ASP.NET
        1. Problem
        2. Solution
        3. Discussion
      6. 18.6. Use SSL Encryption with ASP.NET
        1. Problem
        2. Solution
        3. Discussion
      7. 18.7. Symmetrically Encrypt a File
        1. Problem
        2. Solution
        3. Discussion
      8. 18.8. Symmetrically Encrypt Any Data
        1. Problem
        2. Solution
        3. Discussion
      9. 18.9. Derive a Key from a Password
        1. Problem
        2. Solution
        3. Discussion
      10. 18.10. Asymmetrically Encrypt Data
        1. Problem
        2. Solution
        3. Discussion
      11. 18.11. Combine Asymmetric and Symmetric Encryption
        1. Problem
        2. Solution
        3. Discussion
      12. 18.12. Encrypt an Object
        1. Problem
        2. Solution
        3. Discussion
      13. 18.13. Verify That Data Hasn’t Changed
        1. Problem
        2. Solution
        3. Discussion
      14. 18.14. Create a Tamper-Proof Hash Code
        1. Problem
        2. Solution
        3. Discussion
      15. 18.15. Create an XML Digital Signature
        1. Problem
        2. Solution
        3. Discussion
      16. 18.16. Store a Salted Password Hash in a Database
        1. Problem
        2. Solution
        3. Discussion
      17. 18.17. Generate a Secure Random Number
        1. Problem
        2. Solution
        3. Discussion
      18. 18.18. Generate a Secure Random GUID
        1. Problem
        2. Solution
        3. Discussion
      19. 18.19. Determine the Evidence Associated with an Assembly
        1. Problem
        2. Solution
        3. Discussion
      20. 18.20. Programmatically Restrict Code Permissions
        1. Problem
        2. Solution
        3. Discussion
    21. 19. Useful COM Interop
      1. 19.1. Use ADO Classic
        1. Problem
        2. Solution
        3. Discussion
      2. 19.2. Display a Web Page with Internet Explorer
        1. Problem
        2. Solution
        3. Discussion
      3. 19.3. Drive Internet Explorer
        1. Problem
        2. Solution
        3. Discussion
      4. 19.4. Drive Microsoft Word
        1. Problem
        2. Solution
        3. Discussion
      5. 19.5. Drive Microsoft Excel
        1. Problem
        2. Solution
        3. Discussion
      6. 19.6. Use MAPI to Send E-Mail Messages
        1. Problem
        2. Solution
        3. Discussion
      7. 19.7. Play Media Files
        1. Problem
        2. Solution
        3. Discussion
      8. 19.8. Use Masked Text Boxes
        1. Problem
        2. Solution
        3. Discussion
    22. About the Author
    23. Index

Product information

  • Title: Microsoft® Visual Basic® .NET Programmer's Cookbook
  • Author(s): Matthew MacDonald
  • Release date: June 2003
  • Publisher(s): Microsoft Press
  • ISBN: 9780735619319