Code Snippets
IntelliSense Code Snippets are reusable, task-oriented blocks of code. Visual Basic 2005 includes over 500 code snippets in the box covering tasks ranging from creating a custom exception, to sending an e-mail message, to drawing a circle.
Code snippets can also be used for simple expansions of common programming structures. The code snippets are formatted to automatically include the references they require, and contain replacement fields to allow easy customization.
In addition to the 500 prewritten pieces of code included in-the-box, the Intellisense code snippet library is also extensible. This allows you to create new code snippets that suit your business needs, edit the ones that already exist, or download from third-party vendors and community sites. The code snippet editor is a tool you can use to help create your own snippets. Download the code snippet editor for Visual Basic 2005.
To insert a snippet, right-click in the code editor and select Insert Snippet from the menu, or use the keyboard shortcut (?+Tab). You can also use the Code Snippet Manager to view the full set of snippets that get installed with Visual Basic 2005. The Code Snippet Manager is found in the Tools menu.
Visual Basic Code Snippets
Visual Basic ships with hundreds of code snippets in the following categories. We will be adding additional code snippets at this site in these categories and more in the coming months.
- Application Code Snippets: For working with Isolated Storage, ClickOnce tasks, Console Applications and Process Management.
- Collections Code Snippets: For tasks like creating, iterating, locating elements, and sorting collections like arrays and dictionaries.
- Crystal Reports Code Snippets: For common reporting tasks such as printing a Crystal Report, setting report parameters, and configuring report data access.
- Database Code Snippets: For performing a variety of common tasks around ADO.NET data access.
- Data Types Code Snippets: For various string conversions, date spanning operations, and other type-focused operations.
- File System Code Snippets: For performing a number of tasks around reading, writing, and managing files.
- Language Code Snippets: For inserting conditionals, looping, exception handling, properties, procedures, types and more.
- Network Connectivity Code Snippets: For checking network status, downloading a file via HTTP, performing serial port operations, sending email and more.
- Operating System Code Snippets: A large collection of snippets for Event logging, Message Queues, Process management, registry access, windows services, getting system information and more.
- Security Code Snippets: For working with hashes, decrypting, encrypting, and getting a user’s name.
- Smart Devices Code Snippets: For performing common tasks on Smart Devices.
- Windows Forms Code Snippets: For working with the clipboard, fonts, sounds, GDI drawing, and general Windows Form and control creation.
- XML Code Snippets: For reading and writing XML, selecting nodes, performing XSL transforms, and other XML oriented tasks.
|
|