Sample Code 
-
A small function to convert decimal integer values to a binary string.
The number of bits can be optionally specified but this will be increased if insufficient.. 
-
A VB6 version of Jon Person's .NET NMEA Interpreter Class as referenced in
'How to Write a GPS Application'.
GPStest.zip contains the class and a simple project demonstrating implementation.. 
-
This code snippet demonstrates how to open, read and write to excel files. The concept is very simple. Totally aimed at beginners and well commented!. 
-
This code uses API calls to Hide/Unhide icons on the desktop. This code uses FindWindowEx & ShowWindow API Calls to do the job.. 
-
What do you do when you want to work with numbers that have a total length of digits that reach into the billions? You sure can't store those in a conventional variable, or perform normal operations on them. This module demonstrates how to perform these.. 
-
How to obtain the binary string for the ASCII code of a character.. 
-
Discusses some unexpected implications of using the 'On Error Resume Next' statement in Visual Basic applications.. 
-
Converts an Integer up to 65535 to a String of Binary digits. . 
-
This function will check whether a printer is connected/installed the system. 
-
This code will allow you get the free disk space on a drive which is over 2 Gb in size.. 
-
VB's built in round function will round numbers like 12.085 down to 12.08. This is not correct in all cases as this number should be rounded up to 12.09. This round function allows for this.. 
-
With this code you can highlight VB code. keywords, sub names, and function names are included as well as comments.. 
-
This fairly short piece of code allows the program to check whether a trial period of any length has expired, notifying the user how many days are left. The user is given the option to register the program or just not use it any more. It uses the VB registry setting functions. Encryption can be added when saving to the registry so that almost nobody at all can use the program for longer than the trial period.. 
-
This program tests your ability to react with the mouse to graphical information displayed on the screen e.g. on a game.. 
-
To create tooltip for list-view items, the code checks the item under the mouse pointer in the MouseMove event of the control. It uses for this purpose the LVM_HITTEST message that returns the index of the item at the specified position. The message is sent using the SendMessage API function. The lParam parameter of the function contains the reference to the LVHITTESTINFO structure; you must fill in the pt field of this structure with the coordinates of the mouse pointer before you invoke SendMe. 
-
If you are familiar with Java programming then you would probably know that one has to code in some text editor and then use Command Prompt to compile and run them by using the same old commands. Now that is indeed very annoying and of course there are many editor which allow you to compile and show the output of your code right there and then. Here I am going to show you how you can do this in Visual Basic. The program will ask for JDK Path and the Path of your code.
. 
-
How to convert a HTML colour code to a RGB format.. 
-
This is an ExceptionHandler, what is an Exceptionhandler? Once the wExceptionHandler is installed it will allow you to catch and trap those errors that Windows will throw at your application (Eg. Access_Violation) Which doesnt get treated by the Visual Basic Error handler, making your application bullet proof!. 
-
This is a simple color converter, Using a textbox control to display the color, three text boxes for Red, Green and Blue values, also 3 sliders if the exact rgb color is not known. 
-
Prevent Multiple Instances of a 32-bit VB Application. 
-
A generic implementation of the infamous quick sort algorithm.
Uses a simple callback mechanism allowing any data type inculding UDT's and objects to be sorted quickly and efficiently.. 
-
Here are some examples of sorting algorithms in Visual Basic. It includes the Quick Sort, the Selection Sort, and the Bubble Sort. Bonus code is included for using the Quicksort on a 2-dimensional array, sorting by one of the dimensions.. 
-
In most setup programs you will see the form start as black at the bottom of the form and fade into a light blue at the top of the form. This code shows you how to do just that, with any colour you want!. 
-
Transfer a file over a network with this activeX ocx control. Use this control instead of winsock, and call the upload or download subroutine, its that simple!. 
-
This code will enable your software to create a file/folder shortcut (*.lnk file) using Visual Basic and the Windows Script Host Runtime Library. 
-
This code Checks for newer version of your app using ms agent & inet control. 
-
Find where two lines intersect just by giving this function two X and Y coordinates on the two lines.. 
-
A small uninstaller example I made for windows!
It detects installed programs and let you uninstall them.. 
-
How to install ODBC connections remotely using the Registry API, connect to a network machine, and install users System DSN's without having to travel around sites.. 
-
A Simple VB Game.. 
-
A simple way to closing an application unnoticed if you know the WHOLE caption and it's correct spelling.. 
-
How to pause the code within an event/procedure whilst keeping your application and other controls responsive.. 
-
Example of using MSFlexGrid control instead of list box, to allow formatting of lines of text in the list.. 
-
This neat ready-to-use code lets you build relative references to files (like the ones used in HTML pages).. 
-
Frustrated with the label control's inability to wrap text? Use this bit of code and worry no more.... 
-
How to read various Values from the Registry. 
-
Sample code to make a console mode application. 
-
Automatically login to the MSN Messenger Application. 
-
How to search the registry for your ComputerName. 
-
How to open an item in the Control Panel. 
-
How to program the office assistant. 
-
A function to return the difference between two dates, in hh:mm format.. 
-
Retreive the windows version, service pack and build number using this code. 
-
Use this simple code to compress strings by finding patterns. Decompression code is also included.. 
-
Grab this re-usable code for retrieving the computer name. 
-
How to generate a DLL Base Address using Rnd. 
-
How to enable errors to be reported to the developer. 
-
How to run a dos command from a VB program. 
-
How to display the contents panel of a HTML help file. 
-
How to display the index panel of a HTML Help file. 
-
How to display a HTML Help topic from a Message box. 
-
How to retreive the name of the computer. 
-
How to retreive the current logon. 
-
This code shows you how to launch a program and then wait until it is closed.. 
-
How to find out the registered owner, organisation, product id etc of windows from the registry. 
-
Make LBound() and UBound() even more efficient. 
-
How to 'Pause' your application using the Sleep API. 
-
Save and read conditional formatting as strings. 
-
Shorten a file location in a label with .... 
-
A simple space game in VB. 
-
How to open and close a CD-ROM, and create an icon in the system tray. 
-
This code will change the font of the command button to bold when the mouse moves over it and it will become default when the mouse moves out.. 
-
This simple code shows you how to disable/enable the Ctrl+Alt+Del keys. 
-
This simple code will tell you if you are connected to the internet, and what method you use to connect.... 
-
This Source code will show you how to make tips of the day.. 
-
How to programmatically turn off warning messages in MS Office applications when using Office Automation. 
-
VB myth #3: UBound() returns the number of items in an array. 
-
VB myth #1: There's only one way to code numeric conditional expressions. 
-
How to transfer formatted Rich Textbox text into Microsoft Word. 
-
A tip for determining the size of a VB dynamic array. 
-
Get to know the VBE's event objects. 
-
Monitor a notebook computer's battery information with SysInfo. 
-
Prevent multiple instances of your VB application. 
-
How to add a custom item onto a programs system menu. 
-
How to display a HTML Help topic by specifying its context id. 
-
How to display a HTML Help topic by specifying its filename. 
-
How to shutdown, restart or log off the PC. 
-
How to start and then close an application using code. 
-
How to open and close a CD ROM drive. 
-
Textbox with only numaric content. and two decimals.. 
-
How to disable the Ctrl+Alt+Del and Alt+Tab commands. 
-
A rudimentary encryption/decryption example. 
-
A simpe error handling example. 
-
How to set values in the hi-word and lo-word, and retreive them again. 
-
An example of a MDI (multi-document interface) program. 
-
How to avoid confusion when evaluating the VBE's code line counts.. 
-
A simple stop watch / clock program. 
-
How to prevent phantom apps when using VB 6.0's DataReport. 
-
How to enumerate the windows using the EnumWindows API. 
-
How to evaluate string formulas in VB. 
-
How to read Registry values in VB without complex API calls. 
-
A simple example of how to colour all HTML tags, leaving the text black!. 
-
Another example of how to colour HTML tags. 
-
Evaluate mathematical expressions on-the-fly. 
-
Changes the screen resolution. 
-
Allows you to copy files to the clipboard just like Explorer. 
-
How to loop through all the fonts on the computer and add them to a listbox. 
-
How to retreive a list of the running programs and their paths.. 
-
How to find out if a font is a TrueType font or not. 
-
How to determine the colour depth of the current screen (ie 256 colours, 16bit etc). 
-
How to determine the resolution of the current screen (ie 600x800). 
-
A module containing the declarations you need for using HTML Help Files. 