Description
This book will help you solve more than 300 of the most common and not-so-common tasks that working Visual Basic 2005 programmers face every day. If you're a seasoned .NET developer, beginning Visual Basic programmer, or a developer seeking a simple and clear migration path from VB6 to Visual Basic 2005, the Visual Basic 2005 Cookbook delivers a practical collection of problem-solving recipes for a broad range of Visual Basic programming tasks. It's sure to save you time, serving up the code you need, when you need it.
Table of Contents
-
Chapter 1 Visual Basic Programming
-
Introduction
-
Creating a Windows Forms Application
-
Creating a Console Application
-
Creating an ASP.NET Web Forms Application
-
-
Chapter 2 The Development Environment
-
Introduction
-
Discovering and Using a Code Snippet
-
Creating a New Snippet
-
Sharing Snippets
-
Adding Snippet Files to Visual Studio
-
Getting an Application's Version Number
-
Letting Visual Studio Automatically Update an Application's Version Number
-
Setting the Startup Form for an Application
-
Setting the Startup to a Sub Main Procedure
-
Getting an Application's Command Line
-
Testing an Application's Command Line
-
Obfuscating an Application
-
Determining if an Application Is Running in the Visual Studio Environment
-
Accessing Environment Variables
-
Accessing the Registry
-
Getting System Information
-
Getting the User's Name
-
-
Chapter 3 Application Organization
-
Introduction
-
Creating a Code Module
-
Creating a Class
-
Creating a Structure
-
Creating Other Item Types
-
Creating Object Instances
-
Initializing a Class Instance with Data
-
Releasing an Instance's Resources
-
Using Namespaces
-
Splitting a Class Across Multiple Files
-
Creating a Form Based on Another Form
-
Passing and Returning Structures and Other Objects
-
Creating and Using an Enumeration
-
Converting Between Numeric and String Enumeration Values
-
Creating a Method That Accepts Different Sets of Arguments
-
Using Standard Operators for Nonstandard Purposes
-
Enforcing Strong Data Typing in an Otherwise Weakly Typed Collection
-
-
Chapter 4 Forms, Controls, and Other Useful Objects
-
Introduction
-
Creating and Adding Controls at Runtime
-
Iterating Through All Controls on a Form
-
Sharing Event-Handler Logic Among Many Controls
-
Working with Timers
-
Determining If a Control Can Take the Focus
-
Programmatically Clicking a Button
-
Drawing a Control
-
Making a Form the Top-Most Form
-
Indicating the Accept and Cancel Buttons on a Form
-
Remembering a Form's Position Between Uses
-
Attaching a Control to the Edge of a Form
-
Moving or Resizing Controls as a Form Resizes
-
Limiting the Sizing of a Form
-
Centering a Form
-
Creating and Moving a Borderless Form
-
Creating a Fading Form
-
Creating a Nonrectangular Form
-
Changing Menus at Runtime
-
Creating Shortcut Menus
-
-
Chapter 5 Strings
-
Introduction
-
Using a StringBuilder
-
Creating a String of N Identical Characters
-
Creating a String by Repeating a String N Times
-
Obfuscating a String
-
Converting Binary Data to a Hexadecimal String
-
Extracting Substrings from Larger Strings
-
Converting a String's Case
-
Comparing Strings with Case Sensitivity
-
Comparing Strings Without Case Sensitivity
-
Converting Strings to and from Character Arrays
-
Converting Strings to and from Byte Arrays
-
Tallying Characters
-
Counting Words
-
Removing Extra Whitespace
-
Using the Correct End-of-Line Characters
-
Replacing Substrings
-
Inserting a Character or String
-
Inserting a Line
-
Double-Spacing a String
-
Formatting Numbers into Strings
-
Trimming Sets of Characters from a String
-
Identifying and Validating Types of Data in a String
-
Converting Strings Between Encoding Systems
-
Determining a Character's Type
-
Parsing Strings
-
Concatenating Strings
-
Speeding Up String Manipulation
-
Counting Occurrences of a Substring
-
Padding a String for Exact Length and Alignment
-
Converting Tabs to Spaces
-
Reversing a String
-
Shuffling a String
-
Using a Simple String Encryption
-
Converting a String to Morse Code
-
Adding Strings to an Application's Resources
-
Converting Any Data to a String
-
Using Regular Expressions to Extract All Numbers
-
Getting a Count of Regular Expression Matches
-
Getting the Nth Regular Expression Match
-
Compiling Regular Expressions for Speed
-
Using Regular Expressions to Validate Data
-
Using Regular Expressions to Count Characters, Words, or Lines
-
Converting a String to and from Base64
-
Splitting a String
-
Creating a String of Space Characters
-
-
Chapter 6 Numbers and Math
-
Introduction
-
Using Compact Operator Notation
-
Choosing Integers of the Right Size and Type for the Job
-
Using Unsigned Integers
-
Swapping Two Integers Without Using a Third
-
Using Single- and Double-Precision Variables
-
Using Decimal Variables for Maximum Precision
-
Converting Between Number Types
-
Rounding Numbers Accurately
-
Declaring Loop Counters Within Loops
-
Converting Between Radians and Degrees
-
Limiting Angles to a Range
-
Creating Double-Precision Point Variables
-
Converting Between Rectangular and Polar Coordinates
-
Creating Three-Dimensional Variables
-
Converting Between Rectangular, Spherical, and Cylindrical Coordinates
-
Working with Complex Numbers
-
Solving Right Triangles
-
Solving Any Triangle
-
Determining if a String Contains a Valid Number
-
Converting Numbers to Integers
-
Calculating π to Thousands of Digits
-
Getting a Number's Prime Factors
-
Using Recursion to Calculate Factorials
-
Manipulating Bits with Bitwise Operators
-
Storing and Retrieving Bits in a BitArray
-
Enhancing the Random Number Generator
-
Generating Random Integers in a Range
-
Generating Random Real Numbers in a Range
-
Generating Normal-Distribution Random Numbers
-
Generating Exponential-Distribution Random Numbers
-
Creating a Matrix
-
Inverting a Matrix
-
Calculating the Determinant of a Matrix
-
Solving Simultaneous Equations
-
Listing of the MatrixHelper Class
-
-
Chapter 7 Dates and Times
-
Introduction
-
Getting the System Date and Time
-
Accessing the System's Time Zone
-
Using System Ticks
-
Timing Application Activities
-
Calculating Elapsed Time Using Ticks
-
Calculating Elapsed Time with the Stopwatch
-
Extracting Year, Month, and Day Numbers from a Date Value
-
Extracting Hour, Minute, and Second Numbers from a Date Value
-
Creating a Date or Time Value from Its Parts
-
Formatting Dates and Times
-
Parsing and Validating Dates and Times
-
Adding to Dates and Times
-
Subtracting from Dates and Times
-
Determining the Number of Days Between Two Dates
-
Determining the Day of the Week for a Date
-
Determining the Day of the Year for a Date
-
Determining the Number of Days in a Month
-
Using Controls to Enter or Select a Date
-
Calculating the Phase of the Moon
-
Creating a Calendar
-
Checking for Leap Years
-
Dates and Times in ISO 8601 Formats
-
-
Chapter 8 Arrays and Collections
-
Introduction
-
Filling an Array While Declaring It
-
Sorting Array Elements
-
Reversing an Array
-
Inserting into an Array
-
Shuffling an Array
-
Swapping Two Array Values
-
Resizing Arrays Without Losing Existing Values
-
Quickly Copying Part of an Array into Another
-
Writing a Comma-Separated-Values File from a String Array
-
Reading a Comma-Separated-Values File into a String Array
-
Using a Multivalue Array Instead of a Two-Dimensional Array
-
Converting Between Delimited Strings and Arrays
-
Formatting an Array as a Single String
-
Iterating Through Array Elements
-
Passing Arrays to Methods
-
Returning Arrays from Functions
-
Creating a Collection
-
Inserting an Item into a Collection
-
Deleting a Collection Item
-
Iterating Through a Collection
-
-
Chapter 9 Graphics
-
Introduction
-
Creating Graphics Objects
-
Drawing on Controls for Special Effects
-
Letting the User Select a Color
-
Working with Coordinate Systems (Pixels, Inches, Centimeters)
-
Creating a Bitmap
-
Setting a Background Color
-
Drawing Lines, Ellipses, and Rectangles
-
Drawing Lines One Pixel Wide Regardless of Scaling
-
Forcing a Form or Control to Redraw
-
Using Transparency
-
Scaling with Transforms
-
Using an Outline Path
-
Using Gradients for Smooth Color Changes
-
Drawing Bezier Splines
-
Drawing Cardinal Splines
-
Limiting Display Updates to Specific Regions
-
Drawing Text
-
Rotating Text to Any Angle
-
Mirroring Text on the Canvas
-
Getting the Height and Width of a Graphic String
-
Drawing Text with Outlines and Drop Shadows
-
Calculating a Nice Axis
-
Drawing a Simple Chart
-
Creating Odd-Shaped Forms and Controls
-
Using the RGB, HSB (HSV), and HSL Color Schemes
-
Creating a Rubber-Band Rectangular Selection
-
Animating with Transparency
-
Substitutions for Obsolete Visual Basic 6.0 Features
-
-
Chapter 10 Multimedia
-
Introduction
-
Playing an Audio File
-
Displaying Image Files
-
Playing a Video File
-
Making Your Computer Beep
-
Creating an Animation Using Multiple Images
-
Creating an Animation by Generating Multiple Bitmaps
-
Creating an Animation by Drawing at Runtime
-
Creating Animated Sprites
-
Resizing and Compressing JPEG Files
-
Getting JPEG Extended Information
-
Creating Thumbnails
-
Displaying Images While Controlling Stretching and Sizing
-
Scrolling Images
-
Merging Two or More Images
-
Using Resource Images
-
Capturing an Image of the Screen
-
Getting Display Dimensions
-
Speeding Up Image Processing
-
Converting an Image to Grayscale
-
Performing Edge Detection on an Image
-
Full Listing of the LockImage Class
-
-
Chapter 11 Printing
-
Introduction
-
Enumerating Printers
-
Sending "Raw" Data to a Printer
-
Get Details About the Default Printer
-
Creating a Print Preview
-
Prompting for Printed Page Settings
-
Drawing Text and Graphics to a Printer
-
Determining the Print Destination
-
Creating Graph Paper
-
-
Chapter 12 Files and File Systems
-
Introduction
-
Enumerating Drives
-
Determining if a Directory Exists
-
Creating a New Directory
-
Copying Directories
-
Moving Directories
-
Renaming Directories
-
Parsing File and Directory Paths
-
Searching Iteratively Through Directories and Subdirectories
-
Finding Directories and Files Using Wildcards
-
Determining If a File Exists
-
Getting and Setting File Attributes
-
Accessing Special User and Windows Directories
-
Determining the Space on a Drive
-
Browsing for a Directory
-
Getting File Information
-
Using File-Access Methods
-
Reading and Writing Files as Strings
-
Reading and Writing Binary Files
-
Copying or Moving a File
-
Sending a File to the Recycle Bin
-
Creating a Temporary File
-
Calculating a Checksum for a File
-
Comparing Two Files for Equality
-
Locking a File During Access
-
Reading from a File at a Specific Position
-
Reading and Writing Objects in a File
-
Creating a Comma-Separated-Values File
-
-
Chapter 13 Databases
-
Introduction
-
Connecting to a Data Provider
-
Issuing SQL Commands
-
Retrieving Results from a Database Query
-
Using SQL Parameters
-
Using Stored Procedures
-
Using Transactions
-
Storing the Results of a Query in Memory
-
Creating In-Memory Data Tables Manually
-
Writing In-Memory Data Tables to an XML File
-
Reading an XML File into In-Memory Data Tables
-
-
Chapter 14 Special Programming Techniques
-
Introduction
-
Preventing Multiple Instances of a Running Application
-
Creating a Simple User Control
-
Describing User Control Properties
-
Starting Other Applications by EXE, Document, or URL
-
Waiting for Applications to Finish
-
List All Running Processes
-
Terminating a Running Process
-
Pausing Execution of a Program
-
Control Applications by Simulating Keystrokes
-
Watching for File and Directory Changes
-
Creating an Icon in the System Tray
-
Accessing the Clipboard
-
Adding Tooltips to Controls
-
Dragging and Dropping Files to a ListBox
-
Dragging and Dropping Between ListBox Controls
-
Disposing of Objects Appropriately
-
Fine-Tuning Garbage Collection
-
Moving the (Mouse) Cursor
-
Intercepting All Key Presses on a Form
-
Accessing the Registry
-
Running Procedures in Threads
-
Reading XML into a TreeView
-
Creating an XML Document
-
Validating an XML Document
-
Using Generic Collections
-
Creating a Screensaver
-
Localizing the Controls on a Form
-
Adding Pop-up Help to Controls
-
Maintaining User-Specific Settings Between Uses of an Application
-
Verifying a Credit Card Number
-
Capturing a Console Application's Output
-
Reading an Assembly's Details
-
Performing Serial I/O
-
Rebooting the System
-
-
Chapter 15 Exceptions
-
Introduction
-
Catching an Exception
-
Throwing an Exception
-
Catching Unhandled Exceptions
-
Displaying Exception Information
-
Creating New Exception Types
-
Ignoring Exceptions in a Block of Code
-
-
Chapter 16 Cryptography and Compression
-
Introduction
-
Generating a Hash
-
Encrypting and Decrypting a String
-
Encrypting and Decrypting a File
-
Prompting for a Username and Password
-
Handling Passwords Securely
-
Compressing and Decompressing a String
-
Compressing and Decompressing a File
-
Generating Cryptographically Secure Random Numbers
-
Complete Listing of the Crypto.vb Module
-
Complete Listing of the Compress.vb Module
-
-
Chapter 17 Web Development
-
Introduction
-
Displaying Web Pages on a Form
-
Accessing Content Within an HTML Document
-
Getting All Links from a Web Page
-
Get the Local Computer's IP Address
-
Resolving a Host Name or IP Address for Another Computer
-
Pinging an IP Address
-
Using FTP to Download Files
-
Calling a Web Service
-
Sending Email Using SMTP
-
Getting POP3 Emails
-
Sending a Message to Another Computer
-
Adding Hyperlinks to a (Desktop) Form
-
-
Colophon
Product Details
- Title:
- Visual Basic 2005 Cookbook
- By:
- Tim Patrick, John Clark Craig
- Publisher:
- O'Reilly Media
- Formats:
-
- Ebook
- Safari Books Online
- Print Release:
- September 2006
- Ebook Release:
- December 2008
- Pages:
- 744
- Print ISBN:
- 978-0-596-10177-0
- | ISBN 10:
- 0-596-10177-5
- Ebook ISBN:
- 978-0-596-15877-4
- | ISBN 10:
- 0-596-15877-7
Customer Reviews
