TheGambleFamily.net
Ted's Code Library - No Warrantees Expressed or Implied


This code library represents a collection of tips, tricks, hacks, samples, and actual solutions that I have either encountered or developed myself during my career as a Software Engineer.

Most of the samples found here are from magazines, books, and various code repositories on the internet. I have attempted to give credit to the original source where possible. If you use any of the code or information provided here, please be courteous and do the same.

NOTE: There are NO warranties, expressed or implied, in any of the information presented here. Use is strictly on an "as is" basis. Additionally, please do not contact me to ask questions or to request support, as I have neither the time, nor the desire, to provide additional programming services beyond my regular day job.

 
Enter your search criteria
 
Category:  
Search String:  

Fields to search:
Title    Description    Code    Keywords
 
Total records found:  792
Last update to this repository:  8/12/2010
This query took 0.2030 seconds to execute
 

.Net - ADO.Net

ADO.Net
Using C# to call stored procedures (with and without parameters)

ADO.Net Examples
Examples of how to open connections, read data, and read XML using both the SQLServer and OleDB providers. Shows how to open Jet database also.

Populate DataTable
Demonstrates simple DataTable population using SqlConnection, SqlCommand, and SqlDataAdapter.

Typed DataSets
Demonstrates how to create and use typed datasets in .Net


.Net - ASP.Net

AJAX (for .Net 1.1)
Shows how to use Ajax to retrieve a dataset and populate an HTML div.

AJAX Web Services
Article explaining using AJAX extensions to return results from a web service formatted as either XML or JSON (Javascript Object Notation).

ASP.Net Modal Dialog
Shows how to pass info to and get info back from a modal dialog in .Net

Cache vs. Static Variables
Article comparing ASP.Net Cache object and Static variables.

Caching Credentials in .Net
Uses CredentialCache to cache user's id and password so that user will not have to re-authenticate.

Cookies in ASP.Net
Demonstrates how to use single value and multiple value cookies in ASP.Net

Could not establish trust relationship with remote server
Workaround for invalid SSL certs that result in the "Could not establish trust relationship with remote server" error message.

Default "Enter" Button on ASP.Net Webform
How to create a default "Enter" button in ASP.Net

Determining Image Dimensions (Height & Width)
Code to determine the height and width of an uploaded image

Double Hop Authenication
Explains how to set up you environment so that double-hop authentication can be accomplished between websites.

Encrypting ASP.Net Credentials and Session State Connection Strings
How to use the ASP.NET utility to encrypt credentials and session state connection strings. Applies to 1.0 and 1.1 .Net Frameworks

Encrypting Viewstate
Explains how to encrypt Viewstate in a .Net web application.

Execute a Web Request to Get Data (as in RSS data)
Demonstrates how to open a web request and get data from the source.

Generating Thumbnail Images from ASP.Net
Demonstrates how to generate a thumbnail image from an ASP.Net page.

Global Exception Handling and Logging in ASP.Net
Create a global exception handler that logs errors to a table.

Global.asax
This article explains the ASP.NET application class, global.asax and using context in an application.

How Long Has IIS and the Server Been Running
How to determine how long the IIS process, as well as the server, has been running.

HTTP Modules
Good article that demonstrates how to build and implement an HTTP Module.

HTTP Modules (Like iFilters)
HTTP skeleton code to tap into the ASP.Net pipeline and override certain phases of the request.

Insert Data Into an Excel Workbook and Stream It to the Browser
Insert Data Into an Excel Workbook and Stream It to the Browser

Invalid ViewState Error in ASP.Net
One workaround to try if you are experiencing the infamous Invalid ViewState error in your ASP.Net applications.

Load XML From Remote URL
Demonstrates how to load xml from a remote URL

Loading ASP.NET Templates Dynamically
Load ASP.NET templates dynamically for a DataList Web server controls based on the user selection

Measuring Session State and Cache Contents and Details
Retrieve Session State variables and Cache contents and display their contents (and size for Session

Measuring Session State Size
Demonstrates how to compute session state size

Passing DataGrid Data From One ASPX Page to Another
Demonstrates how to display a datagrid on one page and post it's data (using Server.Transfer) to a second page.

Passing Values Between Two Webforms
Demonstrates how to use Server.Transfer to pass values from one webform to another during the postback.

Registering an Assembly in the GAC
Article that describes how to register an assembly in the Global Assembly Cache (GAC).

Scroll to Control on Page Without SmartNavigation
Demonstrates how to scroll a control into view on a webform

Setting Last Modified Date on Blob Stream
How to set the Last Modified date on an blob stream sent via ASP.Net Response object

Using SQL Server for ASP.Net Session State - Hotfix
Microsoft Hotfix http://support.microsoft.com/kb/836680/

ValidateRequest - Allowing HTML in Form Posts
Explains how to set validateRequest to false so that .Net webforms can post HTML to the server without generating an error.

XSL Transformations .Net
Demonstrates how to perform an XSL transformation on an XML document.


.Net - C#

4181 - Installing the SSL Certificate
You may receive a "Trusted Connection" or "Underlying connection closed" error trying to access the webservice on 4181 from within your .NET code.

Active Directory Search
Returns a dataset from an Active Directory search. Of particular interest is the manner that the LDAP root is determined.

Add, Change, Delete Record Maintenance Sample (ADO.Net and C#)
C# application that uses drop-down to position to record. Has first,prev,next,last record nav buttons. Has add,update,delete buttons. Great ADO.Net sample.

Adding User to Active Directory Group
Demonstrates two methods of adding a user to an active directory group.

ADSI Programming Sample
Demonstrates how to query Active Directory for a particular user, lists groups, isMember, etc.

App.Path in C#
Function to retrieve app.path

Asc and Chr in C#
Demonstrates how to accomplish the Asc and Chr VB functions in C#

ASP.Net Forms Authentication
How to set up and use Forms Authentication in ASP.Net

Aspect Oriented Programming - Intercepting Method Calls for Tracing
This sample demonstrates how to use Aspect Oriented Programming to intercept the call chain in a class' methods in order to capture the value of incoming parameters and return values of the class' methods.

C# Documentation: A Simple Way to Include Examples
Demonstrates how to use Include files with NDoc to provide code samples

Calling C# From VB6
Demonstrates how to create .Net assemblies that can be called from within VB6.

Catching Custom SQL Errors From Stored Procs
Demonstrates how to determine a custom error number when raised from a stored procedure. NOTE: This example uses the DTDataAccess library.

Catching Custom SQL Errors From Stored Procs (Expanded)
Demonstrates how to determine a custom error number when raised from a stored procedure. NOTE: This example uses the DTDataAccess library.

Choosing .Net Collection Classes
Explains the various .Net collection classes and recommends when to use each type.

Code to Map a Drive Letter (and Pass Credentials)
Map a drive letter to a network share

Code to Map a Drive Letter (Picks Next Available Drive)
Code to map a network drive by picking the next available drive letter

Collection Class
Demonstrates how to implement a collection class in C#. Uses a struct as an item and also has a custom enumerator.

Collection Class - The Simple Way
Demonstrates how to implement a collection class using CollectionBase, which makes it much simpler than having to define an iterator, etc.

Collection Class Using Generics and IEnumerable<T>
Demonstrates how to implement a collection class using generics. The class also implements IEnumerable<T>.

Constructor Chaining
Demonstrates how to chain a class's constructors.

Convert ADO.Net DataTable to ADODB.RecordSet
Demonstrates how to convert an ADO.Net DataTable into an ADODB.RecordSet. NOTE: You must set a reference to Microsoft ActiveX Data Objects to use ADODB.RecordSets. If you want to pass the ADODB.RecordSet back to VB6, you must COM+ enable your class.

Convert ADODB.RecordSet to ADO.Net DataSet
Demonstrates how to convert an ADODB.RecordSet into an ADO.Net DataSet

Convert Collection of Objects to DataTable
Demonstrates how to convert a collection of objects into a DataTable

Convert Color Image to Black & White
Shows how to convert a color image to black and white.

Convert to Local and UTC Time
Demonstrates how to convert local to UTC and UTC to local time

Converting String to Byte Array and Byte Array to String
Demonstrates how to convert a string to a byte array and also how to convert a byte array to a string.

Create a Hash From a String
Demonstrates how to create a hash from a string. The string is made more tamper-proof by adding a secret string to it.

Create Thumbnails From Original Image Files (Resize Images)
Demonstrates how to resize images in C#

Creating a Send-To Shortcut to Add a .Net Asembly to the GAC
Explains how to create a Send To-item in your Windows Explorer right-click shortcut menu to install a .Net assembly to the GAC

Creating Non-Rectangular Windows with .NET
Creating Non-Rectangular Windows with .NET

Custom Captions and Extended Properties of DataSet Columns
Shows how to set custom column captions and how to use the ExtendedProperties of columns.

Custom Configuration Section Handler
Demonstrates how to build a custom configuration section handler to handle custom sections in app.config or web.config.

Data Driven Business Entity Objects
Demonstrates how to tag business entity objects with attributes that specify stored procedures, parms, and field mappings so that the business entity object automatically maps to the underlying database table.

Debugging a Windows Service
Describes how to attach to and debug a Windows Service

Debugging Assembly Loading Failures
This article explains the use of Microsoft's Fusion Log Tool to debug assembly load problems.

Deep Copy Clone Using Object Serialize/Deserialize
Accomplishes a deep copy clone of an object using Serialize/Deserialize against a BinaryFormatter. NOTE: The object to be cloned must be marked as [Serializable].

Delegates
Demonstration of how delegate methods work

Deprecating a Method or Property
Demonstrates how to mark a property or method as obsolete (deprecated).

Deserialize an XML Document into an Object
Demonstrates how to take an XML document, and deserialize it to rehydrate an object

Design Patterns
Samples of all 23 design patterns

Determine Pixel is Black and White or Color
Determine if a pixel is within a gray scale tolerance. If not, assume the pixel comes from a color photo.

Disable Right-click Context Menu for Text Boxes
Disables the context menu in text boxes when user right clicks.

Disabling the Close X Button on WinForm
This sample demonstrates 2 wasy to disable the "Close X" button on a WinForm

Disposable Pattern - How to Correctly Implement It
Demonstrates how to correctly implement a disposable pattern.

Dynamically Create DataTable on the Fly
Dynamically create a DataTable on the fly and populate it with data

Dynamically Load an Assembly and Call a Method (Two samples with performance analysis)
Demonstrates 2 ways to dynamically load an assembly and call a method on it. Also contains informance on performance differences between the options.

Dynamically Load an Assembly and Dynamically Call a Method (Two samples with performance analysis)
Demonstrates two ways to dynamically load and assembly and dynamically invoke a method.

Dynamically Load Assembly - Extensible UI
Demostrates how to build an extensible UI that dynamically loads assemblies from a config file

Dynamically Load Assembly and Call a Method
Demonstrates how to dynamically load a .Net assembly and call a method on it.

Encryption/Decryption Using C#
Used TripleDES encryption/decryption. Two samples - One encrypts/decrypts a file and the other encrypts/decrypts a string.

Enterprise Library - Circumventing dataconfiguration.config
Demonstrates how to use Microsoft Enterprise Library, but instead of storing the connection information in the dataconfiguration.config file, it can be stored elsewhere.

Enterprise Library - Explicit Use of Connection Open/Close
Demonstrates how to use explicit open and close connections in Microsoft Enterprise Library.

Enterprise Library Exception Handler - Memory Leak if Used Improperly
If used incorrectly, Enterprise Library Exception Handler leaks memory. See these notes.

Enumeration Sample
Demonstrates how to use custom strings in enumerations

Enumerations - Using Custom String Properties
Demonstrates how to assign custom string values to enumeration elements, and how to retrieve an enumeration element given a custom string.

Enumerations - Using Custom String Properties (Preferred)
Demonstrates how to decorate enumeration values with strings so that you can later retrieve the string value. This uses an attribute class to provide the decoration and an extension method to retrieve the string value.

Environment Variables and Drive Information
Demonstrates how to retrieve environment variables and local drive information in C#

Events and Delegates
Demonstrates how to construct a class that raises events and how to capture those events.

Exceptions
Exception handling philosophy

EXE Name
Demonstrates how to obtain the executable that is running.

Execute DOS Application in .Net
Demonstrates how to run a DOS program in C#

File System Watcher
Detects when changes to a file occur and raises an event

Garbage Collection - Dispose - Class Destructors
Demonstrates how and when to implement class destructors and Dispose().

Generics
Overview of .Net 2.0 Generics.

Generics Sample
This is a simple example that demonstrates how to pass a type into a method using generics.

Get Members of an Active Directory Group
Demonstrates how to retrieve the members of an Active Directory group. NOTE: Does not traverse nested groups.

Get Nested Groups that a User is a Member Of
Returns all nested groups that a user is a member of.

Get Path of Executing Assembly
Works on both web apps and WinForms apps - Gets path of an executing assembly

Getting File Properties for Office Documents
Programmatically read and write the custom properties of Office documents Title, subject, etc.

Getting the Current Time in UTC
Getting the Current Time in UTC

Hi Performance Timer
Hi performance timer

How to Embed and Access Resources Inside of Assemblies
Demonstrates how to embed and use resources inside of assemblies.

Implementing Equals in a Class
Demonstrates the proper way to implement Equals in class.

Installing a Service Programmatically
Demonstrates how to programmatically install a service in C#

Invoking a Class Constructor Using Reflection
Demonstrates how to call a class's constructor and pass in parms using Reflection.

Load Assembly and Retrieve Version Number
Demonstrates how to dynamically load an assembly and retrieve it's version number.

Microsoft Enterprise Library - SQL Transaction Example
Demonstrates how to accomplish transactions in the Microsoft Enterprise Library for Data Access

MSMQ - Putting Objects On and Off of an MSMQ
Demonstrates how to put objects on an MSMQ and the retrieve them back into a rehydrated object.

MSMQ - Simple Example
Very simple example of MSMQ

MSMQ - Simple Example with Native Strings
Demonstrates how to use a custom MessageFormatter to write native .Net strings to a MSMQ and read native .Net strings from a MSMQ. NOTE: If you don't use a custom MessageFormatter, the message body is wrapped in Xml.

MSMQ Triggers
Explanation of how to build .Net assemblies to be consumed by MSMQ Triggers

NT Service Utilities
Demonstrates how to find, start, stop, pause, and ping a service.

Object Creation Using Factory Pattern
Demonstrates how to employ programming to interfaces and creating objects via a factory instead of direct object creation.

Object Creation Using Factory Pattern (Example 2)
Good simple example of how to use a factory pattern when creating objects

Object Serialization Using BinaryFormatter, SoapFormatter, and XmlSerializer
The code demonstrates how to use a BinaryFormatter, SoapFormatter, and XmlSerializer to serialize and de-serialize an object into Base64 and ASCII strings. Two different methods of using the XmlSerializer are demonstrated.

Open a File in its Registered Application
Demonstrates how to open a file in its registered application.

Performance Counters
Demonstrates how to Install, Use, and Uninstall performance counters.

Preserve Whitespace Characters in Serializable Classes
Demonstrates how to make an object serialize it's properties as XML attributes instead of the default manner, which is with XML elements.

Programmatically Register ActiveX Libraries
Demonstrates how to programmatically register ActiveX DLLs, OCXs, etc. using C#.

Read and Write a Text File One Line at a Time
Demonstrates how to read and write a text file one line at a time.

Read and Write Text File Without Character Translation Problems
Demonstrates how to read and write a text file without encountering character translation (encoding) problems.

Read the Registry in .Net
Demonstrates how to read the registry in .Net

Recursive Directory Crawler
Returns list of all files in a directory tree (uses recursion).

Removing UTF Encoding Characters from XML
The Microsoft .Net XmlDocument object inserts Byte Order Mark characters at the begninning of the XML file. This examples shows how to remove them.

Representing Business Entities (XML, DataSet, Typed DataSet or Custom Classes)
Explanation of various patterns for representing Business Entities with advantages and disadvantages of each.

Retrieve IP Addresses and All Network Adapters Information
Demonstrates ways of getting IP addresses and all other information about a PC's network adapters.

Retrieve MAC Address, CPU Processor ID, and Operating System Installation Date/Time
Uses WMI to retrieve a computer's MAC Address, CPU Processor ID, and Operating System Installation Date/Time.

Retrieve Running Processes
Routines to retrieve all running processes.

Retrieving Class Properties and Property Values Using Reflection
Demonstrates how to retrieve the properties and their values of a class.

Samantha's Killer AD Class - Excellent
AD class that gets all info (including nested groups) about a user.

Save and Retrieve a File Into and From a Blob
Demonstrates how to save a binay file into a blob field and then retrieve it

Secure LDAP Connection
Shows the connection string needed to make Secure LDAP calls.

Sending Embedded Images in EMail Messages
.Net framework 1.0 and 1.1 do no support embedded images in emails. 2.0 framework does. The 1.0 and 1.1 workaround is to use CDO inside of a COM wrapper.

Serialize an Object into XML
Demonstrates how to serialize an object into XML and load that XML into an XML Document

Serialize and Deserialize an Object With Xml
Shows a very simple means of serializing and deserializing an object with Xml

Session Object (Like ASP.Net Session State)
Demonstrates how to construct a session object which is similar in functionality to the ASP.Net Session object. The object is thread-safe for multi-threaded environments.

Shut Down and Restart Application on Error
Demonstrates how to shut down an application and restart it when an exception occurs.

Simple Encryption/Decryption in C#
Simple encrypt/decrypt using C#. Output is converted to printable characters. You pass a "magic number" into the encrypt and decrypt function, making it a little more secure.

Singleton - Thread-safe
Singleton object - Preferred way to create a thread-safe Singleton object.

Singleton Objects
Demonstrates how to create a Singleton object (one in which only one instance of it exists for multiple clients). NOTE: This one is not thread-safe.

Sorting a DataTable Using a DataView
Demonstrates how to sort a table in a DataSet and iterate through the sorted rows.

Split Multiple Delimited String into it's Components
Parsing routine that splits a string into it's components

Synchronous Cancellable and Non-cancellable Events
Demonstrates how to retrieve an event's subscribers, raise the events, and retrieve the cancellable flag.

Time Zones - Information and Problems
Information about how to retrieve the time zone and daylight savings settings. Also describes the problem of cached CultureInfo and changes to these settings.

Tracing and Assertions
Philosophy of tracing and assertions.

Underlying Connection Was Closed Webservice Exception
Explanation of how to solve the underlying connection was closed webservice exception. Solution posted by Jan Tielens' Bloggings [MVP]

Use Reflection to Call an Event
Demonstrates how to use reflection to raise an event.

Using Log4Net to Write to Sql Compact Database
Example that shows how to configure Log4Net to write to a Sql Compact database. The database contains some of the built-in information from Log4Net as well as two additional columns.

Windows Service Installer - Sets "Allow service to interact with desktop" Flag
Create a Windows Service Installer that sets the "Allow service to interact with desktop" flag

Wizard Using Panels
Demonstrates how to create a wizard using a single winform which contains multiple panels. Handles Next, Previous, Cancel, Finish. Great framework.

Write an Excel Spreadsheet in C#
Demonstrates how to create a native Excel file and write it.

XML Comment Tags for C#
XML comment tags for use in C#

XML Sample
Demonstrates how to read an XML string and process nested elements

XML Serialization of Objects
Demonstrates how to use the XMLSerializer to serialize and deserialize objects.

XSL Transformations in .Net
3 examples of how do perform XSL transformations in .Net

XSL Transformations in .Net (Simplified)
Demonstrates how to perform an XSL transform against an XML document. Note that this uses the simplified StringWriter to get the textual output of the transform. This results in a UTF-16 encoded file, whereas the traditional methods produce UTF-8.


.Net - LINQ

Linq to Enties Sample
Demonstrates how to replace "Include" in Linq to Entities. Also shows how perform "where" against nested collection.

Linq to Enties Sample - Contains (Similar to "WHERE IN")
Linq sample that demonstrates how to use "Contains" in Linq to entities query. This the T-Sql equivalent of "SELECT Something FROM Somewhere WHERE SomeField IN ('a', 'b')"

Linq to Enties Sample - Group By
Demonstrates how to perform a Group By on two columns and sum on a third column.

Linq to Enties Sample - Group By and Sum Multiple Rows Into Single Row With Additional Columns
Combines multiple lines for the same Item from the same Source (each with a different Inventory) by summing the quantities of specific inventory into a specific Quantity variable.


.Net - Visual Studio IDE

Adding an Item to the Visual Studio "Add References" Dialog
Explains how to add an item to the Visual Studio "Add References" dialog.

Database Projects in Visual Studio .NET
Article by Scott Mitchell that explains how to include a database project in Visual Studio .Net

Determinine if an Assembly is Compiled in Debug Mode
How to determine if a DLL is compiled in debug mode

How to Make a Setup Program Automatically Un-Install Itself
Demonstrates how to cause a Setup program to automatically uninstall itself.

NUnit Setup
Sets up current Visual Studio project properties to run under the context of NUnit

Visual Studio Start Page Project List
How to modify the Visual Studio Start Page project list


ASP

Accessing ASP Objects In VB
Demonstrates how to access ASP objects (Session, Request, Response, etc) in VB.

ADSI Samples - Programming Against an NT Domain
Validate NT users, change NT password, see if account is locked out, etc.

Calling COM Components and Passing Parameters ByRef in ASP
When calling VB COM components from ASP and passing parms ByRef, ASP generates a Type Missmatch Error. This sample demonstrates how to get around the problem.

Client-side Validation Using the XMLHTTPRequest Object
Demonstrates how to use XMLHTTPRequest object to call server-side pages to perform client-side validation.

Create DSN Programmatically
Uses VB to create a DSN programmatically

Create Excel File Download (Demonstrates Formulas)
Creates Excel file download without going through external file creation. Creates an HTML table text stream. The down side of this one is that you don't get the grid-lines in excel, even though you do get cells. NOTE: Set response.buffer = true

Create Excel File Download (Prefered)
Creates Excel file download without going through external file creation. Creates a tab delimited text stream. NOTE: Set response.buffer = true

Date/Time Formatting Utilities
Date and time formatting utilities

Display Excel Chart in ASP
Uses ASP to automate Excel to generate chart that is then displayed in the ASP. NOTE: This is for light traffic sites only.

Display Image That Is Contained In Database Field
Displays an image that exists in a blob field in a database table

Display Page 1 to N Pages With Next/Prev Buttons
Demonstrates how to display 10 records per page with next/previous buttons.

Get AD User Information
Retrieves user account information from Active Directory

Open CSV Text File With ADO
Demonstrates how to open a CSV text file with ADO

Read Binary File Using ADODB.Stream
Demonstrates how to use an ADODB.Stream object to read a binary file from the file system

Read/Write Cookies In ASP
Demonstrates how to read and write cookies in ASP

Response.Redirect to Display Images
Demonstrates how to use an ASP to dynamically display images using Response.Redirect.

Running Out of Process EXEs From ASP
Configuration that is necessary to allow IIS to call out of process ActiveX EXEs.

SAML Sample
Demonstrates how to generate SAML Artifact and Assertion. Excellent examples of Base64 and HexToBin conversions as well as how to deterimine a server's time zone.

Script Timeout
Changing the ASP script timeout value

Send eMail Formatted as HTML Using CDONTS
Uses CDONTS to send an email that is formatted as HTML

Send eMail From ASP (CDONTS)
Uses SMTP service (and CDONTS) to send email from an ASP

Upload File To Web Server
Demonstrates how to upload a file from the browser to the web server.

Use ADO Stream Object to Write Binary Data
Uses ADO Stream object to write binary data to the response object

Using MetaData to Include Type Library Constants
Use MetaData instead of Include files to import type library and DLL functions

Using VBScript Class Modules In ASP
Shows how to create a class module in VBScript and use it on an ASP.

Write ADO 2.5 Recordset Directly to Response Obj
Example of how to write an ADO 2.5 recordset directly to the response object using XML

Zip On-The-Fly Within ASP
Demonstrates how to zip files on the fly from within an ASP page. NOTE: Requires ASPExec component, icuSgDldSvd.dll, and WinZip be installed on the web server.


CSS

Changing IE's Scroll Bar Appearance
Style sheet for changing IE's scroll bar appearance

CSS Sample - Font Family, Font Size, Bold, & Links
The correct way of specifying a font family, a point size, and bold with mouse-over effect.

Downloadable Web Fonts
CSS file that demonstrates how to implement a downloadable web font Also, see the MSDN article: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/fontembed/font_embed.asp

How to Force Page Breaks When Printing HTML Pages
Uses CSS page-break directives to force page breaks when printing HTML pages.

Style Sheets - Named Anchor Tag Appearance
Demonstrates how to use named anchor tag styles


Database

ADO Includes
ADO constants

ADO Marshalling
MSDN Article on ADO Marshalling

ADO Providers
Connect strings for ADO using SQL, ODBC, and Jet providers

ADO Samples
Samples for opening and reading an ODBC data source using ADO.

ADO SQL Server Data Type Mapping
ADO to SQL Server datatype mapping

Connect Strings (Named Pipes & TCP/IP)
Demonstrates how to use network libraries to specify use of either Named Pipes or TCP/IP in a connect string.

Create ADO Recordset On The Fly
Create ADO recordset on the fly and populate it with data

Determine Number of Users in MDB
Determine number of active users in Jet database

Determining Installed Version
How to determine the currently installed version of ADO

FileIO - 1 Approach To Handling DB Ops
Uses Append Chunk to handle MDB files

Getting Available SQL Server Names in Visual Basic
Uses SQLDMO to retrieve list of SQL Servers.

How to Enable ODBC Connection Pooling
Steps required to enable ODBC connection pooling in ADO.

Initialize A Database
This code sets up and initializes the CODMANxx.MDB database.

ODBC Connect Strings
ODBC connect strings with and without data source name

ODBC DSN Creation
Programatically create an ODBC data source

Retrieving IDENTITY Value of Newly Inserted Record
Demonstrates 3 ways to retrieve the IDENTITY value of a record that was inserted into a SQL Server table.

Run Access Report From VB
Use VB to open and run a report in an Access MDB.

Save/Get Binary Data To A Jet Database
Reads binary file and saves in Jet database field. Saves binary from Jet binary field and write binary file.


HTML

Create a Page With a Hidden Frame
Demonstrates how to create a page with a hidden and a visible frame

Transparent Iframe
How to create a transparent iframe

Turn Of AutoComplete On Text Fields
Turns off IE's AutoComplete feature for text boxes (most importantly, password boxes).

Web Page With Automatic Download OnLoad
Demonstrates how to fire off a file download when page loads.


Java

Registering a Java Class in COM
How to register a Java class so that it can be called using COM


JavaScript / DHTML

Allow Only Numeric Characters In Textbox
Allow Only Numeric Characters In Textbox (IE only)

Animated Window Opener - Down Then Across - Way Cool
JavaScript that opens a new window that first expands down then across. Really cool.

Bookmark This Page
Sample of how to add a "Bookmark This Page" link to a page.

Browser Detection (Cookies, JavaScript, etc.)
Uses BrowseCap.ini to determine Tables, Frames, Java Applets, Cookies, ActiveX Controls, Brckground sounds, JavaScript and VBScript.

Browser Detection (Ultimate)
JavaScript file to detect browsers. Covers all of it.

Capture Mouse Down - No Text Selection - on Web Page
Captures mouse down to prevent selecting text on a web page

Change Layer Contents Dynamically (NetScape)
How to dynamically change the contents of an element using Document.Write().

Check Caps Lock
Determines whether caps lock is on or off.

Clickable Labels for Radio Buttons and Check Boxes
This sample makes the labels of radio buttons and check boxes clickable, similar to the functionality of VB check boxes and radio buttons.

Closing Browser Windows
6 ways to close browser windows

Combo Box Magic
Dynamically change combo box contents based on another combo box

Confirm Delete On Anchor Tag With Message Box
Displays a message box to confirm deletion of an item that has a "Delete" anchor tag.

Confirm Form Submit With Message Box
Displays a confirmation msgbox to ask if the user really wants to submit the form

Cookie Utilities (JavaScript)
JavaScript cookie utilities

Copy TextArea Text to Clipboard (IE only)
Demonstrates how to copy text from an HTML TextArea to the clipboard.

Countdown Re Direct Timer
Shows countdown timer prior to redirection

CreateObject In JavaScript (and ADO Sample)
Demonstration of using JavaScript to perform CreateObject. Also demonstrates how to open an ADO connection and recordset in JavaScript.

Date Object Enhancements
Adds three new methods to the JavaScript Date Object: weekOf - Returns first day of week for a given date strDay - Returns the day as a string strMonth - Returns the month as a string

Date Selection Combo Box
Uses 3 combo boxes for mm dd yyyy entry and dynamically re-populates dd combo based on mm or yyyy selection.

Detect if Flash is Installed
Detects whether or not Flash is installed on the client. Works in NS & IE.

Disable Mouse Down - Right Click - on Web Page (IE and NS)
Captures right mouse click on web page to prevent "View Source"

Disable Right-Click To View Source (IE Only)
Captures the context menu that allows View Source and blocks it.

Don't Run Code Unless Document is Loaded
Demonstrates how to delay running code until the page is completely loaded

EMail Validation (Restricts Repeated Form Submission)
EMail validation routine that restricts repeated form submission for 30 minutes.

Expand Collapse (expander.js)
Cool Javascript file to allow each expand/compress sections of your web pages

Fix() Method - Returns a Number Rounded to Number Of Digits
This adds a fix method to the JavaScript number object. The fix() method returns the number rounded to the specified number of digits.

Format Phone Number As (xxx)xxx-xxxx
Formats a phone number in (xxx)xxx-xxxx format. Uses a timer that looks at the input box and reformats it as characters are entered.

Frame Buster
Used to break out of a frame set

Hilight Text in Text Box
Demonstrates how to highlight (select) text in a text box on an html page

Input Mask for Input Fields
Similar to input mask fields in VB, this Javascript allows you to easily implement input masking on web pages.

isBlank and trim JavaScript Functions
Two string prototype functions to (1) trim a string and (2) test for blanks.

isBlank JavaScript Function
JavaScript function to test to see if a variable is blank

JavaScript - Object Oriented Encapsulation/Inheritance Example
JavaScript object that illustrates both prototype-based inheritance and encapsulation.

Javascript Calendar (Great one)
Javascript calendar with drop-down month & year. Works only in IE. Super!

JavaScript Field Validation (Ultimate)
Zillions of JavaScript routines to validate any type of form field.

JavaScript Library
Collection of great JavaScript functions such as DaysInMonth, Chr, Abs, Len, etc, etc.

JavaScript Sleep Function
Function so simulate "Sleep()" in JavaScript

Logoff IE
JavaScript to logoff IE. NOTE: Requires IE6, SP1.

Make External Links Open In New Window
On page load, parses all <a href...> tags, determines which tags point to off-site locations, and inserts a "target=_blank" attribute for those off-site targets.

Maximize Browser Window
Maximizes browser window (but does not click the Maximize button however).

MSN Presence Awareness
JavaScript to put MSN Messenger presence awareness information on a webpage.

Numeric Text Entry Only and Eat Keystroke
Checks for numeric keys only in text box and eats keystroke if not numeric.

Numeric Text Entry Only And Shift Focus To Next
Allows numeric values only and shift focus to next text box when max number of characters is entered.

Persisting Information Using UserData Behaviors
Client-side information can be persisted in the userData behavior in addition to cookies. The userData object persists after the browser is closed and can be retrieved later.

Phone, Zip, Credit Card, EMail, etc. Validation
Validation routines for email, phone, credit card, blank, numeric fields.

Pick/Fling List (Add/Remove List Box Pairs)
HTML page that demonstrates how to implement a pick/fling (add/remove) pair of list boxes where items can be added from one to the other.

Popup A New Browser Window And Set Focus To It
Opens a new browser window and sets focus. If it is already open, it brings it to the forefront. NOTE: Also centers the window.

Print Current Frame
Demonstrates how to use a "Print" button to print the current frame

Print Current Frame (IE & Netscape)
Demonstrates how to print a specific frame

Print IFrames
Demonstrates how to dynamically load up to 5 IFrames with document and then print them.

Print This Page From Browser (NS & IE)
Print this page that works in Netscape & IE

Reload Current Page
Creates a link that reloads the current page

Resize IFrame To The Size Of Its Contents
Resize an IFrame to the size of its contents so that scroll bars do not appear.

Scroll Control into View
Scrolls a control named CurrentItem into view.

Scrolling Marquee - DHTML - Simple & Elegant
Uses <Marquee> HTML tag to create a simple and elegant scrolling marquee.

Scrolling Title Bar
Makes text scroll in the title bar of the browser

Select Text in a Text Box
Demonstrates how to select text (similar to VB sel.start=0, ...) in a text field.

Send Users To Their IE Home Page
Sends user to their home page (as configured in IE). Only works in IE.

Setting the Browser Home Page
Sets the home page for the browser

Simulate "Locked" Property of Text Box
The "locked" does not exist for HTML controls.

Stay On Top
Make a browser instance stay on top of all other windows.

Submitting a Form With an Image Button
Demonstrates how to validate and submit a form with an image button instead of a submit button.

Trim a String
JavaScript function to trim leading & trailing blanks from a variable

Up/Down List Box Magic
Demonstrates how to move list items up/down by clicking the up/down button

Up/Down List Box Magic (Multi-select)
Demonstrates how to move list items up/down by clicking the up/down button (but allows multiple selection of list items)

Up/Down List Box Magic (Uses DIVs)
Demonstrates how to move list items up/down by clicking the up/down button (but has horizontal scroll bars)

Up/Down Select Box Demo
Up/Down Select Box Demo


Misc

Add an Item to Windows Explorer's Right-click Context Menu
Explains how to add a menu item to Windows Explorer's right-click context menu.

Adding "Edit With ..." as Explorer Right-Click Option
Explains how to add a right-click "Edit with..." option for NT Explorer.

Adding Document Icon to PDF for SPS V2
Explanation of how to add custom document icons for SPS V2 search results and document lists.

ADSI - Get Group Members and Get Groups User Is A Member Of
Demonstrates how to obtain members of a group and how to obtain groups that a user is a member of.

ADSI - Part 1 of 3
ADSI routines

ADSI - Part 2 of 3
ADSI routines

ADSI - Part 3 of 3
ADSI routines

AppScan - Code to Validate Querystring and Form Fields
Code to pass an AppScan

Architecture Principles and Groupings
The following explanation of Architecture Principles were written by Mark Schults, a senior Certified IT Architect at IBM. The article was published in March 2007.

Automatically LogOn to NT
Shows how to have the PC automatically log on to NT at startup

Change Domain Password Via Outlook
Explains how to change a domain password using Outlook.

Change IE ViewSource Editor
Registry entry that changes the ViewSource editor in IE from Notepad to something else.

Changing Program Files Directory
How to change the default install directory from ProgramFiles to something else.

Clear the Swap File When NT Shuts Down
Clears the NT Swap File when NT shuts down.

Create Safe Filename
Function that replaces invalid filename characters with "_"

Creating an AutoRun Application for CDs
How to have a program automatically run when a CD (or diskette) is inserted.

Credit Card Validation
Explanation of Luhn's Formula and Credit Card numbering schemes.

Customizing Web-View Background in Explorer
Change the background bitmap when "view as web page" is selected in Windows Explorer

Default Windows Wallpaper
Location of (and how to change) Windows default wall paper (at logon screen)

DOS Prompt Auto-Complete
Causes a DOS prompt to "auto-complete" the first matching directory enty.

Easter Date
Computes Easter for a given year

EBCDIC Numeric Conversion
Convert right byte of EBCDIC number to ASCII number with sign determination also

EM Dashes
This article explains the difference between hyphens, en dashes and em dashes.

FTP Via VB Script and DOS
Demonstrates how to use VB script to control DOS FTP with a script file. This code even uses the FileSystemObject to create the FTP command file on the fly.

Giving NT Services Access to Printers
Steps necessary to allow NT Services to use printers.

How To Change the View Source Editor in IE
How To Change the View Source Editor in IE

How To Use DOS Command FindStr To Search Files
Syntax for searching files for strings

IIS/MTS Nice To Know Stuff (Setup)
Stuff to do when setting up IIS for the first time.

Improving Your Code
Simple ways to improve the quality of your code.

List Directory Contents to a File
List contents of a directory to a file. NOTE: dir /s won't format the output file as well as dir /s /b does. The "/b" switch causes the listing to have the complete path immediately ahead of the file name.

Make the My Computer Icon Display Computer/User
Causes "My Computer" to dispay the user name and computer name on the Desktop

Net Use
Syntax for using "Net Use" to map a network drive

Registry Setting to Unlock IE Security Tab
Registry setting that unlocks IE security settings if they are locked.

Registry Settings for Making NT Boot With NumLock On
Registry settings for making NT boot with NumLock on

Registry Usage
Examples of what registry keys to use. Also Jet registry settings.

Remote Desktop - Norton AntiVirus Configuration
How to configure Norton AntiVirus to allow Remote Desktop

Remove IE Private Branding
How to remove private branding such as "IE Provided by ..."

Retrieve Registered Owner & Company From Registry
Retrieves registered Win95 or NT owner from the registry

Run An Application When Windows Starts
Automatically run a program once (or everytime) Windows starts.

Speeding up Firefox 3.5.5
Config settings to speed up Firefox 3.5.5.

Start NT Explorer With Specific Drive Expanded
Start NT Explorer with a specific drive expanded

Terminal Server Session Information
Displays users that are logged on to a server from Terminal Services

Turn on NumLock at Logon (XP)
Registry entry for enabling NumLock at boot time for XP.

Using "Run As" on a Desktop Shortcut
Demonstrates how to run an application on your desktop under the context of a different user.

Visual Studio Font & Color Settings - How to Save and Restore Them
All of the font/color information for the Visual Studio editor is stored in the registry.

Windows 7 Super Panel
The following was found on http://jeffblankenburg.com. It explains how to create a "Super Panel" folder on your Windows 7 computer where you will have access to all of the control panel features in one place.

Windows XP Performance Tweak
Performance tweak for XP


MTS

MTS Roles Examples
Demonstrates MTS security roles

Registry Setting to Allow IIS to Run MTS Component
You must make this change to allow IIS to run MTS objects out of process (which is the preferred way).

Use MTS to Access ASP Session Info
Uses MTS to access ASP Session, Response, and Request objects

Using MTS in ASP
Demonstrates use of MTS object contexts in an ASP (without actually using an MTS component).


OO Principles

Favor Object Composition Over Class Inheritance
Favor Object Composition over Class Inheritance

Notes on Object-Oriented Approaches by James W. Cooper
Notes on Object-Oriented Approaches by James W. Cooper

Principles of OO Design From the Gang of Four
Principles of OO Design from the Gang of Four as described in "Design Patterns Explained: A New Perspective on Object-Oriented Design", written by Alan Shalloway, James R. Trott, and James Trott


Regular Expressions

Count Number of Word Occurances Using Regular Expressions
VB example of how to use the RegExp object to count the number of word occurances in a string.

Count Number of Words Using Regular Expressions
VB example of how to use the RegExp object to count the number of words in a string

Double Apostrophe/Quote Using Regular Expressions
The following regular expression will double up all single and double quotes.

Extract All Quoted Strings Using Regular Expressions
When parsing a text file that contains quoted strings - such as a VB source file - you might want to quickly locate and extract all the quoted strings.

Extract Words Into a Collection
Uses regular expressions to extract all words and return a collection

Filename Validation Using Regular Expressions
Demonstrates how to validate an inputted filename using Regular Expressions.

Simple Regular Expression Example
Demonstrates how to use the RegExp object from VB

Trim a String And Replace Multiple Occurances of Spaces With a Single Space
With regular expressions we can say, Find occurrences of two of more white space characters (tabs, spaces, etc.) and replace it with a single space.

Trim a String With Regular Expressions
Uses Regular Expressions to trim leading and trailing whitespace from a string.

Validating Phone Numbers
Regular Expression for validating a phone number


Sharepoint 2003

Add / Remove User from SPS Site Group (Role)
Code to add a user to and remove a user from an SPS Site Group (Role)

Add Your Custom Properties to Advanced Search
Here's the step by step on how to add your custom properties into the advanced search function.

Adding Wildcard Search to SharePoint Portal Server
By default SharePoint Portal Server doesn't support wildcard search through the default user interface. This article shows how to add wildcard search with no coding at all.

Copy SiteGroups or Roles from One Site to Another Site
Code to copy Role or Site Groups from one SPS Site to another Site.

Create a Site or Web Using Custom Web Template
How to Create a Site Using Custom Web Template (thru Code)

Creating a Web Service to Run in the Context of Windows Sharepoint Services
This programming task provides an overview of how to create a custom Web service that runs in the context of Microsoft Windows SharePoint Services.

Dynamically Filter a List (or View) Using the Querystring
Shows how to construct a URL to dynamically filter a list (or view) using the querystring

Edit List Permissions in SPS Portal
SPS Lists are secured based on the area to which they belong. This shows how to edit the permissions for an individual list.

Highlighting Search Words in the WSS Search Results
SharePoint 2003 does not highlight searched text in the search results page. This shows how to accomplish this task.

How to Compile Against Sharepoint V2
List of assemblies needed to compile against SPS V2

Move an Item From One SPS List to Another SPS List
Demonstrates how to move one SPS list item from one one SPS list to another SPS list. The code copies the fields and attachment(s) and the deletes the original item.

Read SPS Moderated (Un-Approved) List Items
Demonstrates how to retrieve all items from a moderated (requires approval) list, regardless of whether the items are approved or not.

Retrieve SPS List Data in XML
Retrieves a SPS list contents in XML

SharePoint Search - Part 1
Part 1 of 2 - Explanation of the 4 Sharepoint Search webparts

SharePoint Search - Part 2
Part 2 of 2 - Explanation of the 4 Sharepoint Search webparts

Transform SPS List into Custom HTML Using JavaScript and XSL
The following code, in an SPS Content Editor Webpart, retrieves the contents of an SPS List as XML, and transforms it into custom HTML.

Update Sharepoint "Choice" Field from Database
Demonstrates how to sync up a Sharepoint "choice" field with a list from SQL Server

Using ASP.Net Custom User Controls in Sharepoint Webparts
Demonstrates how to use ASP.Net User Controls in Webparts

Writing Web Parts That Work On SharePoint Portal Server And Windows SharePoint Services
Demonstrates a complex technique for dynamically loading assemblies


SQL Server

Execute DTS Package
Executes a DTS package

Read and Write to the Registry From SQL Server
Shows how to read and write registry entries from within a stored procedure

Run DTS Package From Stored Procedure
Demonstrates how to run DTS package from stored procedure

Show Blocked and Blocking Processes On SQL Server
Stored procedure to displays blocked processes, and which processes are blocking other processes on SQL Server.

SQL Server Data Types
SQL Server 2K data types

SQL Server System Tables and Stored Procedures
How SQL Server stores metadata info about system tables and stored procedures

Triggers - Disadvantages for Using Them
Brief list of disadvantages for using triggers.


T-SQL

Add Non-Nullable Column to Sql Server Table
Demonstrates the best (simplest) way to add a non-nullable column to a Sql Server table.

Combine Multiple Table Rows into a Single String
Demonstrates how to combine multiple rows from a table in a single string to be returned.

Compare SQL Server Databases (Stored Procedure)
Stored Procedure to compare SQL Server database (and optionally, data in tables)

Create an Export File (Uses BCP)
Run system (DOS) commands (such as BCP) from SQL Server using xp_cmdshell

Creating a GUID Using SQL Server
Uses the T-SQL function NEWID() to retrieve a GUID from SQL Server.

Cross-Tab in SQL Server (Preferred)
Stored procedure for creating a cross-tab result set on the fly.

Cross-Tab Query in SQL Server (1)
Demonstrates how to create the equivalent of an Access cross-tab query.

Cross-Tab Query in SQL Server (2)
Creates a cross-tab query from a SQL Server table using Transact SQL

DateDiff2 - This modified function returns how many "date part" is exactly passed.
A modified version of DateDiff. DateDiff Function checks the "datepart" only of the dates. This modified function returns how many "date part" is exactly passed.

Determine How Long SQL Server Has Been Running
Programmatically determine how long SQL Server has been up.

Execute Dynamic SQL In Stored Procedure
Demonstrates how to build dynamic SQL statement in a stored procedure and execute it. Also demonstrates how to convert numeric parameter value to a varchar so that it can be concatenated in the string.

Generate GUID in SQL Server
Stored Procedure for generating a GUID

Generate Native and Synthetic Guids in SQL Server
Demonstrates how to generate native and custom GUIDs with TSQL.

Get Week Information From SQL Server
This procedure will get week information (number, day, start-day, finish) for requested date. By default output dates are in 'mm/dd/yyyy' format. Format of the output dates could be changed (see 'style' info in the SQL HelpFile for 'Convert' function).

List All Tables and Columns In a DB (Stored Procedure)
Stored procedure to list all tables and columns in a database

List All User Tables and Column Information in SQL Database
T-Sql to list all user tables, columns, and column info (including extended description).

Paged Data in a Stored Procedure Using XML
Demonstrates how to pass record ID's into a stored procedure as XML so that you can join against it for paged data.

Paging in SQL Server 2005
Demonstrates how to use the ROW_NUMBER() keyword in SQL Server 2005 to number rows and then return a page of data from a query.

Parse a Delimited String
T-SQL code to parse a delimited string and build a temp table. This simulates splitting the string into an array.

Print SQL Server Exact Date and Time
Demonstrates how to get the exact date/time in milliseconds from SQL Server

Processing XML in SQL Stored Procedure (Simple Example)
Demonstrates how to load XML in a T-SQL DOM

Random Number and Random String Generator
Stored procedure that generates a random number or a random string from SQL Server.

Retrieve SQL Server Logged In User ID
Retrieves User ID from SQL Server

Retrieve T-SQL of a Stored Procedure
Uses sp_helptext to get the actual T-SQL code for a stored procedure

Return IDENTITY Value From Stored Procedure
Demonstrates how to retrieve the identify value of a newly inserted record from a stored procedure. Also presents an alternative to an identify value where the unique id is determined at run time.

SQL NoLock Sample
Shows how to use NoLock in T-SQL

SQL Server Stored Procedures that operate ActiveX
The following SQL Server stored procedures allow you to execute methods in ActiveX components.

Stored Procedure With Cursor
Example of how to use a cursor in a stored procedure to read a recordset

T-SQL Optimization Tips
14 T-SQL optimization tips

T-SQL Script to Import Files Into Table With Blob Field
T-SQL script that imports a group of files from the file system into a blob field in a table. The script assumes that file names match a table that already has records with a list of those files.

XML Basics in SQL Server 2005
Demonstrates how to query XML data in SQL Server 2005


VB

3D - Common Dialog 3D(2)
Makes all forms, controls, and common dialog boxes look 3D. NOTE: BorderStyle of form must be 3 (Fixed double).

3D - CTL3DV2
Makes msgbox, dialogs, and all controls on form 3D.

3D - CTL3DV2 & CTL3D
3D forms - Checks to see if it can first use CTL3Dv2.DLL, then tries to use CTL3D.DLL.

About Screen
Display an "About" message box

Add Bitmaps and Text To A Menu
Adds bitmaps and text to a form's menu

Add Icon to Win95 Tray
Adds and icon to the Windows 95 tray.

Adding Controls At Runtime
How to add controls to a form at runtime

ADO Stored Procedure Samples
Several samples of how to use prepared statements and stored procedures in ADO

Animated Icons
Produces animated bitmaps similar to Netscape's rotating globe.

Associate Win95 File Extensions
Set Win95 & NT file extension associations so that Explorer will run the app.

Attach MS Access Tables
Reattaches MS Access tables on the fly

Audit Log Class
Class for logging strings to a text file

Auto Resize Label Height to Accomodate Text
Auto-resize causes a label to resize horizontally, but not vertically when resizing to accomodate text. This routine resizes the label vertically. NOTE: AutoResize must be FALSE.

Binary Search
Binary Search algorithm

Bubble Sort Routines
Sorts arrays of various types (single, integer, etc) either ascending or descending

Capture screen to a bitmap
Captures a screen to a bitmap image

Center Form
Centers the form passed to it horizontally and vertically on the screen.

Center Form (With Win95 Taskbar)
Centers a form. If Win95/NT4.0 taskbar exists, also centers based on it's height/position. NOTE: See other Center Form example

Center Forms (Relative to Another)
Use VB5's StartUpPosition property to make a form a child of another form and center it relative to the form. (Makes the form behave just like a child of an MDI.

Center MDI Child Form
Centers a child form on it's MDI parent

Center Non-child On MDI Form
Centers a form over an MDI form, but the form being centered is not an MDI child.

Change Background Color of TreeView Control
Changes the background color of the TreeView control

Change Form Border, Tile Bar, Control Box, etc.
Examples of how to change a form border, min-max-ctl buttons, caption/title bar, etc at run time. These are typically design-time properties.

Change Menu Captions Dynamicaly
This is sample code to enabled/disable menu options & change their captions. This sample code is straight from this program!

Change Text Box Pop-up Menu
Change Text Box Pop-up Menu

Clear/Set File Attributes in a Directory Tree
Clears (and sets) file attributes in a complete directory tree.

Clipboard Routines
Copy, Cut to clipboard; Paste from clipboard

Collections - Removing items
Removing items from collections.

Collections (Wrapper Template)
Template for a collection class

Combo Box - Simulate tab stops
Simulates tab stops (evenly spaced items) while loading a combo box. List boxes can use the SendMessage API, but this doesn't work on combo boxes. This routine computes the length of the key string and adds the correct number of spaces at the end.

Combo Box Search
Search combo box, select item, and select text in text area of combo box (like Access does). NOTE: This code goes in the KeyPress event of the Combo Box

Constructing a Bitmap for a User Control
Design specs for creating the toolbox bitmap for a user control (ActiveX control)

Convert Amounts to Words (Check Writing)
Converts currency amounts to words for check writing. Handles up to 999,999,999,999.99 (999+ Billion).

Create Captionless MDI Form
Removes title bar (and access to system menu) on MDI form

Create Excel Chart From VB
Use VB to create a chart in existing Excel spreadsheet.

Create Excel Spreadsheet
Creates a new Excel Spreadsheet and saves it

Create nested subdirectories
Creates all necessary parent directories above and including the requested directory.

Create Path
Creates the passed path, returns true if successful.

Crystal Reports (Preview child)
To make a Crystal Report preview window the child of another window: CrystalReport1.WindowParentHandle = myform.hwnd

Crystal Reports Sample
This code consists of 3 parts. #1 is the printer selection dialog, #2 is the form module, and #3 is the call to the whole thing.

CUSIP Check Digit Function
Computes a check digit for a cusip

Data Bound Class
Demonstrates how to create a class module that is bound to a datasource. This example has 2 parts: A Class Module and a Form Module

Day of Week (Compensates for 9/2/1752 - 9/14/1752)
Dates between September 2, 1752 and September 14, 1752 were dropped when converting from Julian to Gregorian calendar. Access and VB don't correctly handle that fact when computing the day of the week.

DBList/DBCombo - Pointers
Setting record pointers on VB4 databound list & combo boxes

Delay a program
Delay a program for a certain number of milliseconds

Delete File to Recycle Bin
Delete file to Win95 recycle bin (32 bit)

Demonstrates Updatable Disconnected ADO Recordset
Demonstrates updatable disconnected ADO recordset that also saves pending changes to a local disk file on the PC.

Detect Available Drive Letters
Fills two combo boxes. One contains used drives and the other contains available drives.

Determine Excel Spreadsheet Cell Information
Determines value, attributes, formula, and formatting of cells in excel spreadsheet. Requires setting reference to MS Excel Object Library in project references.

Determine Next Available Drive Spec
How to Find Next Available Drive Letter (Excerpt from MSKB - Article ID: Q100834)

Determine VB Environment
Determines if an application is running as an .EXE or running in the VB environment.

Determine VB5 Runtime mode
Determines whether you are running from VB development environment or not.

Dial phone number VB4
Uses TAPI32.dll to dial a phone number

Directories - List all on drive
Lists all subdirectories on a drive.

Directories - List files
Lists all files in a directory

Disconnected Recordsets (Preferred)
Demo of how to open a disconnected ADO recordset

Display Color Palette From a User Control (OCX)
Automatically displays the color selection palette on a user created activeX control.

Dockable Form - Lock at top left
Locks a form in the top left corner of a screen. (Requires Message Blaster VBX).

Document-centered shell execution
Use ShellExecute to open a document with the document's parent application based on the document's extension

Download A File And Save To User's Local Drive
Uses INet control to download a file and save it to the user's hard drive

Drag/Drop Item Into ListBox
Inserts item into a list box at dropped position (Uses SendMessage API to determine top displayed item in the box)

Drag_Drop - Print or run a file
Subroutine to receive a file from drag/drop operation and print to print manager if association exists in File Manager.

Drive Types
Determine disk drive types on PC

EMail Class
Class for sending email

Encrypt/Decrypt as String (Leon's Class)
Encrypts and decrypts a string. The encrypt generates it's own seed each time, so a different encrypted string results. The decrypt will always be able to reconstruct any one of the valid encrypted strings.

Encrypt/Decrypt Password
Two functions to encrypt and decrypt a string.

Encryption/Decryption Routines (Preferred)
Encrypt/decrypt routines

Enter Key to Tab Key
Allows the Enter Key to move from field to field like Tab Key on form level. Also stops beep.

Enum (Hiding Items)
Hide enum items from displaying, but include them for documentation.

Envelope Print Routine
Prints an Envelope, code can be used to print at any direction and size.

Error Display
Displays errors from the Errors Collection with tags that denote database (and ODBC) errors or regular errors.

Exception Handling - Dr. Watson
Demonstrates how to implement an exception handler to handle "un-handled" errors (such as Dr. Watson errors.)

Execute Command Line Statements
Executes command line commands (DOS or Windows)

Extract an Icon From a File and Show It
Extract an Icon from a file and display it

Extract Icons
Used to extrach Icons from other files

File Exists
The Exists() function returns a value of TRUE if the specified file exists, or FALSE if it doesn't.

File I/O
Read a text file (such as AUTOEXEC.BAT)

File I/O Read a binary file
Best way to read a binary file

File Info
Retrieves file information (date created/changed, etc.)

File Notification (Monitor Directory For Changes)
Demonstrates how to use File Change Notification to automatically process files.

File Search (with overlap)
Searches a file for a string. Performs overlap in the event that the string spans two blocks.

File to DB - DB to file (32 bit)
Routines to save file to a DB field and read DB field to re-create the file.

File Version Information
Retrieves company name, version info, etc. for a given filename.

FileSystemObject Example
Using the FileSystemObject to read a text file. You can also get directory and file info.

FileSystemObject Samples
Demonstrates usage of the FileSystemObject to read, write, copy, delete, etc.

Find MDI Form
Finds the MDI form in an application.

First/Last Day of Month
Determine dates of first and last day of a given month

Floating Toolbar (Toolbar)
Creates a form with a custom caption bar that can be moved (dragged) around the screen. This form is also made to "appear to be a child" of a parent form and float on top of it, but it does not float on top of all of the other forms that are open.

Form - UNMOVEABLE
Makes a form unmoveable

Form No Resize
Once form is set to a certain size, this routine will keep it the same size, except when minimized

Format Diskettes
Formats a diskette (or drive)

Format Diskettes (Without Prompting)
Code to format a floppy that doesn't prompt the user with the normal format dialog. The SHFormatDrive API prompts the user with a dialog box. This function does not.

Format Numeric Text
Various routines for formatting text for Date6, Date8, Time12h, Time24h, etc.

Format/Diskcopy Routines
Format floppies. Copy floppies.

Generate Random Numbers Between X And Y
Generate range of random numbers

Get App.Path for a UserControl
Determines the App.Path of the application that hosts a user contol (ocx).

Get Disk Free Space (32 bit)
Computes amount of total, free, and used disk drive space

Get File Description
Determines file type description

Get Internet Name From Global Address Book
Retrieves Internet Name for members of global address list

Get Primary Domain Controller Name
Returns the Primary Domain Controller (PDC) name of a Windows NT domain.

Get Relative Path Between Two Directories / Files
Determines the relative path between two directories (or folders). For example: C:\A and C:\Winnt\System32 returns ..\winnt\system32

Get Volume Label
Retrieves Disk Volume Label

Gradient Form Background
Creates a gradient shading for a form

Help Menu Commands
Commands for accessing help for project and Windows

Hide MDI Child Forms
Hide MDI child forms VB 3.0 does not allow you to Hide an MDI child window but the Windows API does. This is the routine to do so.

Hide Mouse Pointer
Hide Mouse Pointer. Routine to show and/or hide the mouse pointer.

HotTracking on a List Box
Implements mouse Hot Tracking in a list box

Icon Programming in the System Tray (Preferred)
Demonstrates how to build an application that uses an icon in the system tray.

Icons - Get number & draw
Determines number of icons in an EXE, DLL, or ICO for a file that has an association in File Manager.

Import Text File Then Export As Word Document
Imports a text document and exports as a Word document

INI File Manipulation - Profile Strings
Example routines of how to work with INI files. Posted on Visual Basic Listserver/Newsgroup by Andrew O. Dennison. You must add the calls to the FUNCTIONS to perform desired tasks.

INI files
To Write or Read APP.INI files

Initial Caps Within A String
This routine capitalizes the first letter of each word in a string. (All characters following spaces and hyphens. Also capitalizes the first letter after Mc for names.

Insertion Sort Routines
Sorts arrays of various types (single, integer, etc) either ascending or descending

Interface Implementation (Multiple Obj Interfaces)
Demonstrates multiple interfaces of an object

Is Form Loaded
Determines if a form is loaded

Justify Text (Right or Left)
Right or Left justify text in a field

Key Press Validation
Various routines to validate key presses on date, numeric, currency, etc. text boxes.

List Box Cumulative Search
Searches the items in a SORTED list box based on all characters typed by the user

Listbox Vertical Scroll - Detecting it
Determines when a list box has been vertically scrolled. ONLY detects scrolling using the up/down buttons, elevator, or scroll areas. Does not detect up/down arrow key inside of list area. This can be trapped using the list box's click event.

Long File Names (Retrieving)
How to retrieve a long file name from the 8.3 translation. (ie. Retrieve "program files" instead of "progra~1", etc.

LPRINT-Setting Properties By Arguments
Simulates the LPRINT in earlier versions of BASIC

Mail Merge Using Word and Outlook
Demonstrates how to perform a mail merge using Word and the Outlook Contacts folder.

MAPI Samples
Demonstrates how to create an email message to multiple recipients and attachments.

Menu Text (how to modify)
Change menu text before windows calculates the menu width.

Minimize ALL Forms In Your App
To minimize all of your application's forms place the code below into the appropriate event which you want to trigger this action.

Mod 10 Check Digit
Generates a mod 10 check digit for any string inputted.

Modify Excel Spreadsheet
Modify existing Excel spreadsheet, prints it, and saves the changes

Mouse Cursor
In case you changed the mouse to a different cursor in an earlier routine then change it later, this routine resets the mouse back to the previous cursor.

Mousepointer Coordinates - Obtaining
Gets the x and y coordinates of the mouse pointer when the event DblClick or Click is invoked.

MS Word Routines
Routines for opening documents, printing, mail merges, and table creation. Requires reference to MS Word 8.0 Object Library in project references.

Numeric Base Conversions
Two functions to convert decimal to another base, and another base to decimal.

Open NT Explorer With Specific NameSpaces Loaded
Open NT Explorer with specific NameSpaces loaded

Outline Routines
Routines for adding, deleting, moving items in the MS Outline VBX.

Parse a String Into Words
Parses a string into individual words (uses a space as the delimeter) and places each word into an array named WordArray

Parse string into indivual lines
Breaks a long string up into wrapped lines for printing.

Pause Processing By Seconds
Suspends processing for a few moments

Persisting Class Data
Demonstrates using a class to save object with ADO and metadata

Persisting Objects (In Classes)
Persists object data

Play AVI, MPEG, Quicktime files
Play any multimedia movie file

Play WAV From Resource File
Plays a WAV from a Resource File NOTE: This has to run from an EXE. It will not work in the VB IDE.

Playing An AVI Or WAV File
Playing an AVI or WAV

Position Text in Control
Positions text inside of text box or label (left, center, right adjusted).

Print a Form
Prints a form to the printer

Print Bitmaps From VB
Add a picture box to your form and put your image in it.

Print Grid and Print at Location
Prints a grid template to position on preprinted forms. Also contains routine to print at specific location, given a global offset.

Print Shaded Grey Lines/Areas
Print Shaded Grey Lines/Areas

Printer Control - Passthrough Escape
Passthrough Escape Printer Control 'Using PASSTHROUGH Escape to Send Data Directly to Printer Article ID: Q96795: Copyright 1993 Microsoft Corporation. All rights reserved.

Printer Margins
Set printer margins. Left is set at 0.5 inches and right is top is set at 0.75 inches.

Printer Setup
Printer Setup Dialog Box

ProgMan - Activate ProgMan for DDE
Call this sub before starting DDE with Program Manager. Restores Program Manager to forefront.

ProgMan - Create Program Group
Creates a Program Manager group.

ProgMan - Create Program Manager Icons
Create (or place) icons into program groups in Program Manager

ProgMan - Delete Program Manager Group
Delete a group from Program Manager

Progress Bar - Copying Files
Show a progress bar when copying files

Project Settings for ActiveX DLL & EXE Components
VB project settings for ActiveX DLL and EXE components

Provide Insert Object Dialog for Rich Text Box
Provide Insert Object Dialog for Rich Text Box

Purge FileName Entry
Routine that removes invalid characters from a filename and returns the result as a string.

Quick Sort Routines
Sorts arrays of various types (single, integer, etc) either ascending or descending NOTE: Works best if array is not sorted

Read Files Of Unknown Record Length
Read files of unknown record length

Read Standard Input Channel
Reads the standard input channel

Register Un-register OCX, DLL, OLE Servers
How to register OCXs, DLLs, and OLE servers

Register Un-register OCXs and DLLs Programatically
How to register OCXs and DLLs from a VB program. All COM components export the DllRegisterServer and the DllUnregisterServer functions. Call these to register/unregister the component.

Registry
Read/write registry/ini files

Removes Path from Filename
Function removes path from fully-qualified file name, returns file name only.

Restore MDI Child With Enter Key
This routine allows the user to press the ENTER key while a minimized child form (within an MDI application) has the focus to "restore" the window.

Restore Previous Instance
Finds and restores a previous running instance of app

Retrieve List of Local Machine Adminstrators
Retrieves list of NT users that are authorized to administer the local machine

Retrieve NT SID or Account/Domain Info
Retrieves SID for an account, then retrieves the AccountName and Domain for the given SID.

Retrieve UNC Path For a Drive
Returns UNC path for a drive letter

RichTextBox Margins
How to set print margins in VB4 RichTextBox

Rotate an Image Around the Center of a Form
Rotates an image around the center of a form (or any object)

Rounding - A Function To Do It
Rounds numbers to specified decimal positions

Rounding - A Function to Do It 2
A sample rounding function

Run Control Panel Applets From VB
Run any of the Control Panel applets (install printer, etc.) from VB. See web site www.mvps.org/vb and follow the "tipsheets" link. Uses "rundll32.exe shell32.dll" functions

Run the Shortcut Creation Wizard
Demonstrates how to run the "Create a Shortcut" wizard, giving an end user the ability to create a new shortcut.

Run Word via OLE (32 bit)
Run Word using OLE (32 bit)

Save/Get Binary Data To SQL Server (Preferred)
Saving and retrieving binary data (such as an image) to/from a SQL Server field.

Saving & Retrieving Information to a Property Bag
Demonstrates how to save information to and retrieve information from a property bag.

Saving Class Property Bag Data
Demonstrates how to convert property bag information to stream data that can be saved and retrieve from a file. NOTE: This is a stripped down version of the Persisting Objects (In Classes) sample

Send eMail Via Outlook
Uses Outlook to send email from a VB app

Send Windows PopUp Message to Workstations
Uses WinPopUp to send a message to a workstation

Set File Date/Time (16 bit)
Set a file's date/time. Requires VBASM.VBX.

Set Mask Edit control to blanks
Set a masked edit control (that requires numbers) to blanks

Shell Sort Routines
Sorts arrays of various types (single, integer, etc) either ascending or descending NOTE: Best overall compromise for a general sorting routine

Shut Down An Application
Shuts down an application that contains the Window's title. This will not work if a modal form from the same application is opened. It will work if a MessageBox is displayed. If more than 1 instance of the app is running, use Enum Windows API.

Simulate Drag/Drop With The Clipboard
Emulates Windows Explorer drag/drop file move/copy using the clipboard

Size a Label, Form, and Command Button
Sizes a label and it's container form, and positions a command button at the bottom (as in a message box scenario.)

Smart Forms (Remembers position)
Routines to display a form in the same place that it was previously displayed, then save its new position

Sort ListView list control
Sorts a listview control (like Win95 explorer) when user clicks on column headers. If listview is currently sorted by clicked column, sort order is reversed (just like Windows Explorer)

Specified Path Is Valid
Determines is a passed PATH is valid.

Spellcheck Using Word
Uses OLE automation to spell check a text box using Word's spell checker.

Split & Reassemble File
Split file and reassemble file for Setup installation

Status Bar Display
Subroutine to display status bar and have percent string reverse colors as bar passes over string.

Status Bar Display (in Status Panel)
You can't normally place a progress bar in a status panel. You can, however, copy the image of a picture box into the picture property of a status bar panel.

System Color Hex constants
Hex Constants for system colors

Tiles an Image on a Form
Tiles an image contained in a Picture Box across the entire form

Time - Convert 24 hr to 12 hr format
Converts 24 hour time to 12 hour am/pm format

Time (Display on menu bar)
Displays the current time on a menu bar

Timer (High resolution)
Determines high resolution timer ticks (VB4)

Timestamp Fields In SQL Server (ADO)
Demonstrates how to retrieve/update records that contain timestamp fields.

Title Bar - Creating A Thin One
Creating a thin title bar on a form.

Type Ahead combo box
Add the following code in the Change event of a combo box. I will position to the matching entry with each keystroke.

Universal Time (32 bit)
Determines current Coordinated Universal Time (32 bit)

Unload All Forms
Unloads all forms at close (2 methods)

Update Graph data Via A Timer
Changes graph data with timer. To run it place a graph control and a timer on your form. Set timer interval e.g. to 1000.

Use Common Dialog ctl with Multiple Long File Name
Use the Common Dialog Control with Multiple Long File Names

VB6 Controls
OCX filenames for VB6 controls

Wait for Shell Completion (32 bit)
Wait for shelled program to finished (32 bit)

Wavs in VB
To get .WAVs to work in VB

Web Browser (IE)
Navigate to a URL using Internet Explorer

Week Days Between Dates
Determines number of week days (work days) between two dates, inclusive.

Wipe File
Overwrites a file on disk with Xs and spaces to prevent recovery

Write Standaard Ouput Channel
Writes to the standard output channel

Writing to the NT Event Log
How to write to the NT event log

Writing to the NT Event Log (Preferred)
Demonstrates how to write to the NT Application Event Log


Web

Associating an Icon With a Web Page
How to associate an Icon with a web page so that it appears next to the URL when the page is bookmarked.

CDO - Send Mail as HTML
By default, CDO uses plain text. This shows how to change the format to HTML.

Change Cursor on Web Pages
Demonstrates how to use custom cursors on web pages

Clear Cache When Your Application Hosts WebBrowser
Clear Cache When Your Application Hosts a WebBrowser Control

Content Ratings
Content ratings sites and info

Country Selection
Country Selection combo

Create Word Document On The Fly
Demonstrates how to use ContentType to make the browser open a word document with text loaded into the document.

Creating Internet Shortcuts
This shows the format of an internet shortcut. This file could be sent as an attachment in an email.

Cybercash Credit Card Sample
Demonstrates how to perform credit card validation with Cybercash

Date Picker #1
A popup window appears allowing the user to select a date simply by a clicking it. The user can navigate to previous and future dates, and the selected date is displayed in your form. Great! Uses a .js file so it's easy to re-use this code on your pages.

Date Picker #2
Very similar to Date Picker #1

Determine Image Height, Width, Color Depth, Type
Routine to determine height, width, color depth, and image type of an image. Also, a routine to proportionally resize an image on an ASP by generating the HEIGHT & WIDTH attributes of the image <IMG> tag.

Determining IE's Start Page
Shows the location in the registry where IE's start page is kept

Dialog - Modal/Modeless
Demonstrates modal and modeless dialogs and communicating between windows.

Disable Password Caching in IE
Disable caching of passwords in IE

Display Icon in IE Address Bar
Demonstrates how to place in icon (.ico) in the address bar of IE.

Display Web Page Without Formatting (For Printing)
An ASP that uses a FileSystemObject to output the HTML so that it can be viewed in a browser without the HTML formatting.

EMail Sample
Demonstrates how to email a user their password

Fade Effect on Page Transitions
Meta tag to cause pages to fade on transitioning between pages.

Find Parent Window
Routine to locate the progenitor of a series of windows

Force Open / SaveAs Dialog on Downloads
Forces browser to show the Open / Save As dialog, even if the file extension is a known MIME type.

HTML Encode/Decode Text String
Applies HTML encoding rules to a string of text (changes < to <), etc.

HTTP Meta Tags
Listing of META HTTP-EQUIV tags.

IE6 - Unlocking AutoComplete on Forms
Registry setting that locks down allowing users to enable AutoComplete on forms.

IIS Host File (LMHost)
Location of LMHost file

Iterating Through a Collection
VBScript and equivalent JavaScript sample for iterating through a collection

Location of .asp Icon
Location of the default icon that is used for .asp files

Mail This Page To A Friend
Demonstrates how to create a Mail This Page to a Friend link

Maintaining State By Using a Database
Demonstrates how to maintain state in ASP by storing values in a database.

Meta Tag Search Keywords
How to tag your site for search engines

MIME Types (ContentTypes)
Common MIME types

Open Excel, Word, PDF, etc. in IE Natively
Demonstrates how to open a document directly in IE. NOTE: Uses BinaryWrite on an ASP that calls a VB component. NOTE: Set response.buffer = true

Passing UserID and Password On The URL
Demonstrates how to pass a UserID and Password on an HTTP request.

Password Protection
Forces the password entry box when a page loads

Prevent Page Caching
Header pragmas to prevent pages from being cached

Prevent Page Caching (Prefered 1)
Best way to expire a page. Works even if user hits BACK button.

Prevent Page Caching (Prefered 2)
Prefered headers for no caching

Raise a File Download Dialog for a Known MIME Type
Displays a file download dialog box instead of displaying the document inside of the browser

Redirect to Different Page Using HTTP Headers
Uses HTTP headers to redirect to a different page instead of Response.Redirect

Rollovers (Uses Clip Regions)
Creates rollovers with only two (large) images instead of individual GIFs.

Send Mail When User Clicks Button
Mail someone when a user clicks a form submit button.

Spell Check HTML TextArea (Uses Word)
Uses Word2K to spell check an HTML TextArea client-side.

State Selection
State Selection combo box

Status Property Usage
You can use the Status property to send an HTTP status code and reason phrase. Common uses for the Status property are forcing a password dialog box to appear or automatically redirecting a user to a new page.

URL Encode/Decode Text String
Same effect as Server.URLEncode and Server.URLDecode

WWW - Read a web page textually
Reads the HTML from a web page and outputs the string so that it can be parsed.


Windows API

About Screen (API)
Display an "About" message box using the Windows API

Add Font to Windows
Adds font to existing Windows installation

Add Items To System Menu
Adds items to Control Box Menu

Always on Top (32-bit)
Forces a window to always be on top.

Animated Cursors
Demonstrates how to change the cursor to an animated cursor and then change it back again.

App Loaded
Determines if an app of the passed classname is loaded.

Call Click Events
Calls click events on command button, check boxes, and option buttons.

Center Form (With Win95 Taskbar - Preferred)
Takes into account size of task bar when centering a form

Change a Form Icon (Alt-Tab)
Changes a forms icon and makes the new icon display when switching tasks using Alt-Tab

Change Screen Resolution
Code to change screen resolution

Change Wallpaper
Changes Windows wallpaper

Colors (16 or 256)
Determines if current video driver is 16 or 256 color

Combo Box (Auto drop down 32 bit)
Automatically open (drop down) a combo box.

Computer Name in Win95 and NT
Determines Win95 or NT computer name.

Copy File (Win95 Explorer-like)
Copies, moves, etc. files using the Win95 Explorer floating folder, progress bar interface.

Copy Picture from 1 control to another (quick)
Copies picture from one control to another using BitBlt() API

CPU Type
Determines PC processor type (386, 486, pentium, etc.)

Create Subdirectories on the Fly
Creates complete directory tree for specified path

Create Win95/NT Shortcut
Creates Win95/NT shortcut. NOTE: See alternate "Create Shortcut (Uses DDE)" sample. It is preferred over this one.

Cursor - Make A New One
Make a new CURSOR?

Determine How Computer Was Booted
Determines how a system was started

Determine Video Resolution
Determine video resolution mode

Exit Windows (and Reboot)
Subroutine to close Windows from a Windows App.

Exit Windows (and Reboot) 32-bit
Exit windows and reboot the workstation (or server)

File Version Info
Retrieves file version information

Fill List Box with Drives/Dirs/Files
This routine fills a standard list box with a list of drives, directories, and files using a Windows API call.

Find File
Uses API to locate a file. NOTE: Returns first location found. Does not continue to search.

Find Window (32 bit)
Activates an application if it is running and sets focus to it. (32 bit)

Find Window Text (32 bit)
Search windows task list for window containing string and optionally activates it to the foreground (32 bit) NOTE: Text search works on partial and complete.

Find Window (partial or contains)
Searches the windows task list for a window that either contains or starts with the search string.

Find Window (Windows Task List Loop)
Loops through windows master task list looking for the main window handle of an application's instance.

Find Window Example
An example on how to find a window based on the TitleBar's caption.

Find Window Filename
Finds the handle of the window whose file name matches the passed filename.

Flash Window
Cause a window to flash

Font Installation VB4-32
Install fonts under 32 bit Windows or NT

Free Space on Drive
Determines free space on a drive

Get Associated Executable
Returns complete path and file name of the EXE that runs for the given file extension. For example: MDB returns C:\Program Files\Microsoft Office\Office\MSACCESS.EXE

Get Free System Resources
Returns the system resources in the form of percentages converted into strings.

Get Windows Directory
Get Windows Directory

Get Windows\System Directory
Returns the location of the windows\system directory

GUID - Creating One
Creates a GUID

Help (Accessing it)
Myriad of help calls

Hide and Show Windows Task Bar
Hides and shows Windows task bar

Hide Record Selector in Grid
Prevents the record selector from stepping through a grid during iterating through the grid.

Hide Windows
Use ShowWindow API to display/hide windows

Hiding The Menu Bar Dynamically
This routine allows you the dynamically remove the title bar from a VB form. Patterned after the PC Tech column in PC Magazine 6/14/94. Volume 13, Number 11

Identify Networked CD drives
GetDriveType reports networked CD drives as DRIVE_REMOTE. Combine that with GetVolumeInformation and you can determine that it is both a networked drive and a CD drive.

Impersonating Users
Logon to NT using a user profile (as in NT Services) to obtain priviledges

INI Class
Class to read/write INI files

Limit Number Of Characters Typed In ComboBox
A textbox has a MaxChars property. A combo box does not.

List Box Search (32 bit)
Automatically select list box items when user enters text in text box.

List Running Processes
Retrieves list of running processes on NT, Win95, and Win98

Listbox Item Pre-Selection
Preselects items in a listbox

Listview Subclassing
Demonstrates changing behavior of listview control

Lock Workstation
API call to lock a workstation

Minimize an Application's Window
Subroutine to minimize an application's window. (You must know the CLASS of the window prior to doing this.)

Monitor a Directory for Changes
Monitors a path and triggers an event when a change occurs.

Move Forms Without Title Bars
This example was posted on the internet and shows a way that a form without a title bar can be moved around by the user with a mouse.

Move Mouse to and Click a Control
Move the mouse cursor to, and/or click, any absolute location on screen.

Multi_Thread (Synchronous)
Creates 4 threads that each call the same function that uses a Mutex to synchronize the operation. NOTE: This causes a GPF for some reason, but the code appears correct.

Multi-Thread (Non-synchronous)
Creates 4 threads that each call the same function and demonstrate impact on un-synchronized functions. (Mutexes and Semaphores solve the synchronization problem.)

Network Tid-Bits
Some network information passed along by a helpful soul on the internet.

Popup Menu Tracking Routine
Popup menu tracking routine

Prevent Window More/Resizing
Prevents a window from being moved or resized

Previous Instance of Application Running
Determine if previous instance of an application is already running.

Print Clipboard (ActiveWindow or Screen)
Copies active window or complete screen to clipboard then prints it.

Registry (Using it)
Routines to add/delete keys & values, and retrieve values from the registry

Remove Control Box Menu Items
Removes menu items from a forms Control Box menu

Remove Min/Max Buttons From MDI Form
An MDI form doesn't have min/max button design-time properties like a regular form does. This code provides a means of disabling the min/max buttons on an MDI form.

Remove System Menu Item Of Given Form
Removes system menu item of a given form

Resize Combo Box Drown-down Width
Resizes the drop-down area of a combo box

Resize Drop-down Combo Box
Resizes the list area of a drop-down combo box to other than the default 8 lines.

Restore App
Restores the window whose handle you pass to it.

Screen Resolution
Determines whether screen is set to VGA or higher

Scroll a List Box
Programatically scroll a list box

Search For A Window
Search for a window whose caption partially matches a string

Select All Items in a ListBox
Select all items in a list box (fast method)

Set Default Printer
Displays list of printers and allows sets the default print to the one selected

Set File Date/Time (32 Bit)
Set a file's date/time

Set Tab Stops in a List Box
To set ListBox tabs you need to use an API call to SendMessage.

Show the Dialog to Connect/Disconnect Netwrk Prntr
Show the dialog to connect/disconnect a network printer

Show the Standard BrowseForFolder Dialog
Show the standard BrowseForFolder dialog to select a folder.

Simple Scrollable Read-Only Textbox
This routine call the Windows API to make a textbox be "Read-Only". The text is NOT gray, the Scrollbars STILL WORK, Text can be selected & copied but cannot be modified or deleted.

System Resource Status Win95
Displays memory status and size, swap file size, and total system resource utilization.

Tab Stops in List Box
How to set the tab stops in a list box

Text Box - Read only
Makes a text read only

Text Box - Undo changes
Aborts changes to a text box

Text Box - Undo Operation
This option calls the Windows API to UNDO the last action in the ACTIVE text box. (CUT operations can not be undone as this code is - must be Pasted).

Timer (Benchmarking)
VB4 benchmarking routines

Timer (Using API)
Create timer using API (does not require a form)

Undo Text Box Entry
Undo enterred data in a text to its previous value

User Name
Determine who's logged onto the computer

User Resources
Find User Resources

Wait for Shell (Uses API)
Wait for shelled program to finish. Uses API WinExec instead of SHELL.

Wait for Shell (VB4-32)
Wait for shelled program to finish for VB4-32 bit only.

Wait for Shell Completion
Wait for Shelled program to complete execution


XML

Caching XSL Processor to Improve Performance
The transformNode & transformNodeToObject methods compile XSLT stylesheets every time a user makes a request. Instead, use an XSLTemplate DOM object to cache the compiled XSLT stylesheet and use the XSLTProcessor DOM object to activate the transformation.

Client-Side XML/XSL Transformation
Demonstrates how to load an XML and an XSL file and transform them client-side.

Create XML Document from ADO Recordset
Creates an XML Document from an ADO recordset

Get, Update, Save Data Using Client-Side XML (XMLHTTP)
Demonstrates how to retrieve an ADO recordset from a server, modify it, & send it back as a stream of binary data using the IXMLHTTPRequest object. NOTE: The cool part is that it uses client-side JavaScipt & XMLHTTP instead of posting an HTML form.

Navigate XML DOM
Demonstrates how to navigate the XML DOM

Passing XML Objects Between Client and Server
Demonstrates how to post XML data using XMLHTTP from a form to an ASP.

Properties and Methods of the IXMLDOMNode Object
Properties and Methods of the IXMLDOMNode Object

Retrieve ADO Recordset As XML Stream
Converts ADO recordset to an XML stream

Save and Rehydrate ADO (2.5) Record Using XML
Demonstrates how to open a normal ADO recordset, save it as XML, and then re-create an identical ADO recordset from the XML.

Save and Restore ADO Recordset Using XML
Persist and re-load an ADO recordset as an XML stream.

Transform XML With XSL in ASP
Uses Transform Node to transform xml with xsl stylesheet

Using XMLHttpRequest to Post a Web Page
Demostrates how to use XMLHttpRequest to call an ASP from client side script and pass XML DOM.

XML - File Upload Example
Demonstrates how to use XML to upload a binary file to a web server

XML - Web Page Hit Counter
Outstanding demo of how to use XML to create a web page hit counter

XML Samples
Various info on XML

XML Special Characters
These characters, <, &, >, ", and ' must be substituted with the following character codes, respectively: <, &, >, ", and '

XML/XSL Examples
Explanation of using XML and XSL on a web page

XmlHttpRequest - Make Server-side Call From Client-side JavaScript (Similar to Ajax)
Demonstrates how to use the XmlHttpRequest object to make an asynchronous web request from a web page to retrieve information via a server-side processing page. Works with IE and non-IE browsers.