K & K Consulting    K & K Consulting

K&K Home VB Guru Home Search VB Site VB Code VB Tips VB Tutorials VB Questions

K&K Home
Code Snippets
Upload Your VB Code


VB Code & Snippets





BAS Files









Win Networking


Code Snippets




Time Zone Conversion 

This file includes all code listings for Mark Tucker's August 1999 feature, "Next Stop: The Time Conversion Zone," as well as the complete source for the article. The source incorporates a sample VB program and ASP page to show you how to use it. 



SMTP Email 

Do you want to send Email from your Applications but do not want to have the hassle of MAPI,  CDO or Exchange?  Well this DLL will allow you to send HTML or Text based Email from your Applications with just one function call.  For HTML based, you can send full HTML code to create professional looking Emails. Includes the ActiveX DLL and a sample application to show you how to use the DLL.  

NOTE:  This code will only run on a Windows 2000 based system that uses DNS.

NOTE 2: This code has been updated on May 27, 2001 to solve some DNS entry problems

This code was written by the VB Guru




The MsgHook DLL is an ActiveX component written in VB6, that lets you perform safe and efficient subclassing even from within the Visual Basic IDE in debug (break mode). 


NT Log Events

NT Log Events

LogNTEvent is a class that lets a VB app write directly to the NT event log. The zip file includes a demo project and a sample DLL that contains the messages to be logged.



Versioning Your Object

When incorporated into an ActiveX Object, this Class will allow any COM compliant, client application, to query your Object for Major, Minor and Build properties, plus a few other goodies. The Client Application can then verify versions and compile date.

This code was written by the VB Guru


Timer Lite.zip

Timer Lite DLL

This timer works just like the standard timer OCX in VB but is an ActiveX DLL format, allowing you to use a timer in your ActiveX EXE's and DLL's. This is the full compiled DLL, just download the DLL, register it, add a reference in your project to it, then use as you would any other timer

This code was written by the VB Guru


Timer Lite.zip

Fire Events From Classes In A Collection

This is a sample project that will demonstrate how to fire events from classes in a collection

This code was written by the VB Guru



Best Blue 468x60

VB IDE Add-In's


Error Handler Add-In

This addin greatly simplifies adding error handling to VB programs. Simply register the DLL using REGSVR32 and the addin will be added into the Visual Basic tools menu. Keep the two template files in the same directory as the DLL. Move the cursor within 10 lines after the procedure name line and activate the add-in by pressing Alt-T-E or by clicking on the menu: all the error handling code will be added automatically. The templates can be modified based on preference, as explained in the Readme.txt file.



Extended Search Add-In

This add-in augments the VB IDE with the capability to search a string or a pattern across all the modules of all the projects loaded in the environment. Better yet, all the matches are displayed in a non-modal, hierarchical treeview control, so you can move to each occurrence by simply double-clicking on it. All the usual search options are supported, included search for whole words and for a regular expression. All the recent searches are kept in an history list, and you can dock the window as you would do for any regular IDE window. This add-in comes with fully commented source code! 



Property Addin

This addin greatly accelerates the process of creating new property procedures, both in class, form, UserControl and UserDocument modules. You enter the name of the property, its type, its arguments (if any), its initial value (if any), scope (Public, Friend, Private), type (read/write, read-only, write-only, write-once/read-many), and the addin creates the code for you. You can also create Default properties by ticking a checkbox in this dialog, without having to invoke the Procedure Attributes dialog. If you add a description to the property, this will become a header comment and, at the same time, the string will be assigned to the Description attribute of the property. The addin comes with a number of predefined properties and attributes, that can be then selected from the "Name" combobox. 




Doc-U-Mentor is a free VB Add-In that creates Function and Subs on the fly, including Synopsis.  The Synopsis places your function name, date, compiler version and the developer name.  It will list all the parameters ect.  Have you created your app already and just have to document it? No problem, just set the option to Header only and it will just create the synopsis.  This little puppy will defiantly reduce your coding time. Compiled DLL only

This code was written by the VB Guru



Base Addresser

Addresser is a free VB Add-In for creating base addresses for ActiveX Dll's and OCX's.  When you want to create a new address before compiling, just start the wizard, it will generate the address for you, verifying against a database, that the address has not been assigned.  Can be installed on a network for sharing with multiple developers. Compiled DLL only.

This code was written by the VB Guru


Spell Check VB

Spell Check VB

This addin is designed to check the spelling of your VB comments and/or double-quoted string literals inside your VB6 IDE using a procedure similar to MS-Word without checking the rest of the code. The advantage of this Addin over commercially available code spell checkers is that it (1) can also check the double-quoted strings inside vb code without checking the rest of the code, (2) can supply custom options and a dictionary, (3) is free, (4) comes with full source code so you can create a version in a foreign language and make enhancements. You are only required to have MS-Word 2000 or MS-Word 97 because this Addins VB code needs the objects they expose. It is also possible to change this code to use MS-Excel in place of MS-Word or completely different objects. Two versions are supplied with a setup.exe and source directory: one for MS-Word 2000 and the other for MS-Word 97.

900 KB

Download From MZ Tools Web Site

MZ Tools For VB 6

MZ-Tools 2.0 is a freeware 'all-in-one' Add-In for Visual Basic 6.0 which adds several features missing in the VB 6.0 IDE. It provides a main menu, a toolbar, handy context menus or customizable shortcuts to access those features.

Through a dialog window, you can customize several Add-In features to meet your development standards (data type prefixes, template for procedure headers, template for error handler, etc.) or your personal preferences (user name, shortcuts, etc.)

For your convenience, the add-in has been localized in the following languages: English, Spanish, French, Italian, German and Portuguese.

Installation is as simple as downloading the Add-In (a DLL file and a configuration file compressed in a .zip file) to a single folder and registering the DLL file with regsvr32.exe (a setup program is not needed). If for any reason you do not like the Add-In and want to uninstall it, simply unregister it with regsvr32.exe /u and delete the files.

You can run the Add-In from a local disk or from a network shared folder (probably read-only to ensure that all developers of a team are using the same Add-In customization established by a team leader).

137 KB


BAS Files

Text Box Features

Provides access to features of the text box control not exposited directly to VB. Code & Samples. 4.39kb

DCOM Stuff

BAS file with error handling and remote procedure use for DCOM applications.   1.99kb
FormFades Routines for making really cool fading effects on any form 645b
Roll Form Routines for making your form "Roll Up & Down"  depending on if the mouse is over the form.  When the user moves the mouse over the title bar, the form rolls down. When moved off, the form rolls up

This code was written by the VB Guru

Shell Functions Container for calling the most popular shell.dll API's

This code was written by the VB Guru



DB Info

By supplying a DSN entry, it will attempt to connect to that database and list all the tables in it. When you click on a table, it lists all the fields and the attributes it can. Its been tested on MS-Access and Sybase on NT and Unix and works well. Again, all source is included.  4.24kb



DHTML Sounds

Do you want to play sounds on your website when a user presses a button or on a mouse over event?  Well here is a sample HTML file that will pre-load the files from the server to the client browser, then when you set the proper tags for MouseOver(), Click(), or any DHTML event, it will play the sound of your choice.  Full documentation and samples included.
Note: This file is a txt file in the zip file, to use it, just download extract the txt file,and rename it to a .htm file.



VB ASP Class for RS

This is a VBScript class that will generate and write an HTML table filled by a RS. All you have to do is pass set its connection and SQL properties. The table will be pageable and sortable by clicking the column heads. You can set the column heads to text or images. 
You can also set on of the columns to have a link (like a tradenum going to a trade details page). 
This is a nice example of how to use a VBScript class. 
Note, this is a .inc file in the zip file,  after unzipping the file, use the include tag to Include it in your ASP page, or rename it to a .ASP file. This file is very well documented.





Sample application that implements FTP connection, download, and upload using the WinInet FTP API from Visual Basic. Includes all source code.


ASP Chat


Version 3.0 of ASPChatWorx, upgraded 07/05/2000, is a chat application implemented entirely in ASP and is ready to run immediately. All you need to do is create a virtual directory for the application, and copy the files from the .zip file into that directory. Refer to the readme.txt file for more information. 
Note: Version 3.0 of the application works on IIS but not PWS. 


Download from Microsoft

Web Services and the SOAP Toolkit for Visual Studio 6.0

Web Services represent the next evolution of this shift, extending the concept of off-the-shelf software with that of software delivered as a service. Web Services are building blocks that enable developers to build and aggregate applications and services from local and remote resources for a range of clients.



This program converts Visual Basic source code into a form suitable for displaying on a Web page. It converts special characters such as < into the proper codes (&lt;). When it finds a ' not inside a string, it treats the rest of the line as a comment and makes it bold.



Dial the Net Automatically

Does your application need to connect to the Internet?
Most code snippets simply show you how to display a typical connection dialog box. This method has three basic flaws; it doesn't force a dial-up, often requires the name of the connection and doesn't let you know when a connection has been made.
Thankfully this code snippet solves all those problems by using Internet Explorer's own automatic dial-up settings.
If you double-click the Internet Options icon in the Control Panel, you'll notice the Connections tab hosts a list of possible dial-up connections.
This snippet utilizes a couple of little-known API calls that can automatically dial-up and disconnect from the default connection in that list – just like Internet Explorer does if it needs to connect to the Net.
Note: If the 'Never Dial a Connection' option is selected, this code will not be able to connect. It does as Internet Explorer does, and Internet Explorer simply wouldn't connect if that option was selected.
It's worth noting that this code pauses until the connection is actually made - or not, as the case may be. And that's definitely a good thing.




Control Panel App Zip File

Control Panel App

All in one Control Panel Applet Loader.


Tool Tip Class

Extended Tool Tip Class

Use this class to show fully customizable, multi-lined, tool tips using the tool tips class from comctl32.dll.The Tool tip can have Muli-Lines, custom colors, a Title, an Icon and style. It looks like the W2k tool tips



Extended Message Box Class

This code provides two extended MsgBox functions: MsgBoxMove and MsgBoxPause. MsgBoxMove function allows you to display your message box at a location specified by you: Syntax: MsgBoxMove(hwnd, Message, Title, Buttons, X, Y) MsgBoxPause function allows you to have the message box automatically disappear, after pausing for a number of seconds specified by you. Syntax: MsgboxPause(hwnd, Message, Title, Buttons, Seconds) Like the Msgbox function, each is capable of returning the value of the button clicked.The project consists of two files: MsgBoxEx.bas and MsgBoxEx.frm. The former contains the functions and the latter exemplifies the use of them. 

Usage: Include the MsgboxEx.bas (less than 50 lines in total) in your project and you have these two functions at your disposal.

The Guru's Note:
It came to my attention that this link pointed to the wrong ZIP file, it has now been corrected, 10/25/2000



Extended Message Box Class DLL Version

This code is the same as the above code, just in a DLL version that I converted.  I have not tested this with multiple instances of the class running at the same time; this may or may not cause a problem, due to the call back functions.  If it causes problems, try changing the main class to Single use.

Includes all DLL code and a test project


Visual Studio Service Pack 4

Visual Studio Service Pack 4

Service Pack 4 (SP4) is a free download containing all previous service pack updates (SP3, SP2 and SP1). SP4 fixes some compatibility issues with previous versions of Visual Studio and provides updated versions of DAO, HTML Help, MDAC, Scripting, and OLE.


VB LiteTimer.zip

Lite Timer Class

This handy class module by Kieron O'Connor lets you add a control-less timer to your application, without actually using a Timer control. Beside being useful in itself, the CLiteTimer class provides a great example of how you can correctly implement Windows callback procedures. The class comes with a complete demo program that demonstrate that you can create multiple forms with many a timer on them. 

The Guru's Note:
I played around with this code and it is really good.  I stripped the Class and BAS files out, and put them in an ActiveX DLL.  Works like a charm.  Note, the download code is the original, not the DLL version


Timer Lite.zip

Timer Lite DLL

This is the full compiled DLL as I described in the above Lite Timer.  Just download the DLL, register it, add a reference in your project to it, then use as you would any other timer



Download from Microsoft

Visual Studio 6.0 Service Pack 3

Visual Studio 6.0 Service Pack 3 provides the latest updates to Microsoft Visual Studio 6.0 development system and its component products. Service Pack 3 is recommended for all Visual Studio 6.0 users, and is currently available free for customers to order on CD or download.




Common Dialog File

New Type Common Dialog Control

Common Dialog with multiple selections Win98 explorer type. Includes OCX code only, no sample Application.

Wheel zip File

New Type of Slide Control

An alternate to using Sliders, Scrollbars and UpDown controls. Not just an enhanced version of an existing type of control, but a new type of control altogether. Scrolls values up and down with the use of Visual thumb wheel, includes the ability to "Spin Over" to Minimum value when Maximum value has been attained and visa-versa. Includes OCX code only, no sample Application.

Color Picker Control Zip File

Color Picker Control with Sample Code

It is a color picker control, which is almost similar to those you find in MS Office 2000 applications. Includes OCX code and sample application code.

ListBox Control with Images

Listbox Control with Images

This is a multi-lined, per item, Listbox control with images

Animation Control

Animation Control

This control uses the Animation control from comctl32.dll to show animations from files or resources. For Example the moving Flash Light in Explorer or Network Places.



The cPopMenu control is a really simple way to get icons into a VB project's menus. It also allows you to create arbitrary new submenus, gives you control over the system menu and has some useful new events indicating when menu items are highlighted and exited. Sample Projects, Control Code & full documentation are included.

These projects require the SSubTmr.DLL component. Make sure you have loaded and registered this before trying any project. 



SSubTmr.DLL for use in other projects listed here



SSubTmr6.dll for use in other projects listed here here Note: This is a different DLL then SSubTmr.Dll, they are not compatible, you must download the correct version if the project calls for it.


Hover Button

Clock Control

A clock control. Drop the control on a form where it will display the time.


Hover Button

Enhanced Command Button

This is an enhancement of the standard command button. The additional properties include "mouse-over" forecolors and backcolors, an Image property, a borderstyle property, and a "mode" property (text-only or image-only mode).


3D Line Control

3D Line Control

Tired of drawing double lines to get a 3D effect.  What happens to the lines when you want to resize the form in run time?  Well here is an OCX control that does it all for you.  Includes the compiled control and all source code.

This code was written by the VB Guru


Easter Egg Control

Easter Egg Control

What to tell everyone how good of a developer you are. Well now you can, with a hidden Easter Egg that is. Includes OCX, source code and examples.

This code was written by the VB Guru


Make Your Computer Talk

Make your computer talk  



NT/W2K Service Control For VB

NT/W2K Service Control for VB

Microsoft’s  OLE Control that enables developers to create Microsoft Visual Basic applications that function as Microsoft Windows NT/Windows 2000 services. With the NTService control, you can install a service, log events, and respond to start, stop, pause, and continue events.

The Guru's Notes:  This control works great, I have created a few Service applications with this control, I have had no problems what so ever.

Includes OCX and  code samples for both VB and C++

108 KB

DownLoad from Tx Text Control

TX Text Control

TX Text Control is royalty free, robust and powerful word processing software in reusable component form. It is all you need to build complete word processing, intranet and desktop publishing applications. With TX Text Control, you get hands-on access to the most comprehensive set of word processing features available in a development toolkit.



Right Click.zip

Register With a Right Click 

After downloading and executing the contents of this file here, you may rightclick on any ActiveX-DLL or -OCX to register or unregister it.
0.5 kb



Colour i5

If you write HTML code, or Visual Basic code, or whatever kind of code, you sometimes need to know what a color is in the correct format. We ran across a neat little utility called Colour i5 that displays the numeric value, the HTML value, and the VB Code value for any color under the cursor.


Classy i5

Classy i5

Classy i5 is a class spy that generates Visual Basic code.
Courtesy of http://www.em.f2s.com/


Download from zdnet

Find & Replace

Find and Replace 2000 is a free program that can locate and then replace a string of text in one or more ASCII-based files. Filters for text, batch, HTML, and .ini files are provided. If you change your mind about the replacements, press the Undo button and the files will be restored to their original state. In addition, you can add bookmarks to frequently used folders to save yourself a few clicks in the future. Find and Replace 2000 deserves a look if you need to make changes across multiple files.


Download from zdnet


DataBox is an exceptionally easy and fast way to publish a database on the Web or an intranet. An easy-to-use interface lets you quickly load the data, select the way you want the resulting information to appear, and publish your database in HTML format. Because DataBox imports delimited files (database information saved in text format from your program), it can handle data from virtually all the major database programs. It handles up to 5,000 records for each database, with 20 fields each. You can also include up to four images with each record. You have complete control over the appearance of the data and can use a very handy search option. A built-in FTP client lets you quickly upload your finished files to your server. 


Download from zdnet

Ulead GIF Animator lets you quickly produce compact GIF animations for your Web page with drag-and-drop simplicity.  

Download from zdnet

Visual Studio® Installer 1.0

Microsoft® Visual Studio Installer is a graphical tool that simplifies the creation of application setup programs for distribution to single user or enterprise-wide desktops. Setups created with the Visual Studio Installer provide advanced capabilities such as centralized distribution for maintenance and updates, application self-repair, and powerful installation rollback facilities.

Visual Studio Installer setups are based on the new Microsoft Windows® installer technology. The Windows installer reduces the total cost of ownership (TCO) for customers by enabling them to efficiently install and configure applications. The Windows installer is part of the Windows 2000 and Zero Administration Windows (ZAW) efforts to reduce the overall cost of deploying, using, and managing desktop computers.

This replaces the Package & Deploy Wizard that originally shipped with Visual Studio 6.



Make an icon file out of a bitmap, and vice versa 16.3kb




CPU Usage

Gets the CPU Usage for Windows 2000. This is a sample of using PDH.DLL to sample performance data from Windows 2000. It can be used to monitor any performance data. Should also work in NT 4.0 (Requires VB6 and PDH.DLL - included with Win2k).


Common Win API Functions

This little file contains a little application, with all the source code, to show how to use some common Windows functions. e.g. system information, how long the computer has been running, cursor blink rate and environment variables.  11.79kb


Get a Temporary Filename

Have you ever needed to temporarily create a file, yet were concerned about overwriting any existing data? Fear no more.
This code snippet is a useful function that returns a guaranteed unique filename.
You simply call the GetTemporaryFilename function, optionally passing it a filename prefix. It then returns a unique temporary filename, ready for you to utilise.
Note that this function doesn't actually create the file, but rather gives you a unique name suggestion. The file creation is down to yourself.



Drag & Drop

This is a DLL that can add a drag n drop feature to your applications, you'll be able to drag files from explorer to your applications. Its very simple and easy to use. It uses subclassing to capture the WM_DROPFILES message and all that is done in a class. You can drag enable any common controls like treeview, listview, edit boxes etc,.Besure to read the ReadMe file included in the zip file for explanation of whats going on in the component. Please send comments and suggestions at my email address. Have fun with the Drag Component.


Win Networking


Ping With VB 

This code will allow you to ping any IP address on the network or Internet.  

The Guru's Note:
This code was sent to me as plane text, to be used in a GUI application. I thought is would be more useful to strip out the code and put it into an ActiveX DLL, this way you could use it as a COM/COM+/MTS object to be used by any client, including an ASP page, good code re-use.  I have massaged a tremendous amount of this code, sorry to the author

The zip file includes source code, DLL and demo application



Map Network Drive

Map A Network Drive 

When users run your applications, it will be a pain if they have to start Windows Explorer to map a needed drive. This DLL provides us with a way to map and unmap drives from within an application, it allows the creation of network drive mapping or un-mapping, both through code or through the use of the built-in windows dialogs. 

Comes with DLL and DLL source code, plus and application to test and get you familiar with the DLL.

The Guru's Note:
This code was sent to me as pure text, so I converted it into the DLL for you, plus I corrected some bugs and properly set all the compile options.


Network Info

This little demo will return, using Windows API calls, the following: IP Address, Network Username, WorkdstationID, Windows version, build version and service pack info, the windows directory, the PDC name if you are logged onto an NT server and the time on the PDC. Full source code is available for you to use as you feel fit.  2.85kb


MSXML Parser

MSXML Parser

If you haven't downloaded the final MSXML parser, you'll definitely want to do so. Microsoft has made it, along with its SDK documentation, available

MSXML Merge Module

XML MergeModule

While you're there, you can pick up the MergeModule Redistribution Package for Visual Installer too



Best Blue 468x60





Send mail to WebMaster with questions or comments about this web site.
This website is best viewed with a screen resolution of 800*600 or better.
This website is optimized for Microsoft Internet Explorer 6.x
K&K Consulting, Proud to be a Microsoft Business Partner.
Last modified: January 31, 2002