misc VB knowledge


If you have questions about any of the information contained below, you can email me at

[email no longer available]


but I make no promises as to response. If you have a technical question, you are better off going to one of these forums:

VB forums             Code Guru             Extreme VB Forum

also, there is a list of useful links: at the bottom of this page for VB related information, and those sites are FAR more extensive than this one



what's listed here:


ADO for absolute beginners Click here to download the ZIP file: ADO tutorial doc
-      -      -      -      -      -      -      -      -      -      -
This MS Word doc was lifted off of a forum some time back and it is what I used to get myself started on using ADO to access an Access db. The verbiage is a bit smarmy, but it's quite a decent little tutorial for beginners. I have now done up my own sample that is even MORE basic than this example, but mine is a complete VB project and the needed sample db, and is more extensively commented. You can get it by clicking here:simple ADO tutorial project
Taken together, these two should really get you on the road to ADO usage.


Binary Tree Click here to download the zip file: binary tree project
-      -      -      -      -      -      -      -      -      -      -
this project shows two things; recursion and a binary tree. It is specifically written to sort a list of dates, and remove duplicates, using a binary tree insertion sort, but it is easily modified in any number of ways to do other things. For example, if you want to COUNT duplicates instead of removing them, that is very simple to do, and if you want it to deal with words or numbers instead of dates, that also is very simple to do. This is the simplest solution to the classic problem "get an alphabetized list of all the unique words in a document and give a count of how many times each word is used."


Compile Controller Click here to download the zip file: compile controller
-      -      -      -      -      -      -      -      -      -      -
This file includes the complete source (Compile.zip) and listings (listings.doc) for John Chamberlain's November 1999 feature, "Take Control of the Compile Process." which is an arcane but useful technique for enhancing your ability to merge C/C++ and VB programs by way of an addin called CompileController.dll which is provided here. The article can be seen here: article link. This zip file was provide by "techyspecy" on vbforums (http://www.vbforums.com) which is one of the two best VB forums on the internet


Color Contrast Click here to view the algorithm: color contrast
-      -      -      -      -      -      -      -      -      -      -
A solution to the problem of finding whether white or black is the better contrast to a given color, so you can choose the best background for lettering of the given color, or choose the best letter color (white or black) for a given background


Crypto Click here to download the project: crypto
-      -      -      -      -      -      -      -      -      -      -
A project showing how to do 3 different simple encryption/decryption schemes. Although the project uses text messages for the discussion, the techniques are immediately applicable to any byte array, so can be used to encrypt any type of file or data.


decompiler Click here to read about why there is no such thing: decompiler
-      -      -      -      -      -      -      -      -      -      -
Despite desires to the contrary, there is no such thing as a VB6 decompiler and there never will be. Here's a discussion of why.


DLL Click here to download the ZIP file: VB <---> C++ DLL tutorial project
-      -      -      -      -      -      -      -      -      -      -
This tutorial project shows how to transfer the most common VB data types (int, long, single, fixed string, and string) to a DLL written in C++ and how to get the same data types back from such a DLL. It also shows how to pass a user defined type ("structure" in C/C++) back and forth so that you can do all kinds of data types all at the same time. It uses VB6 and MSVC++ 6


Elliptical Form Click here to download the ZIP file of the project: VB project to create elliptical form
-      -      -      -      -      -      -      -      -      -      -
simple code to create an elliptical form in VB


Email Click here to view the code: email code
-      -      -      -      -      -      -      -      -      -      -
simple code to send an email using Outlook (from VB)


Excel Click here to download the ZIP file: Excel tutorial project
-      -      -      -      -      -      -      -      -      -      -
This tutorial project shows how to manipulate Excel objects from VB, including how to create a spreadsheet, how to read one, how to write to an existing one, how to put data into an excel graph and then display that graph on the VB form, and more, including examples of early binding and late binding


file concatenation Click here to download the ZIP file: file concatenation tutorial project
-      -      -      -      -      -      -      -      -      -      -
About every week or so on one of the VB forums I participate in someone asks how you go about concatenating files into a single file. I've never found any use for this but it was a minor exercise to create the code, so I did. There is no encryption, but that's not hard to add (see the Crypto tutorial project also on this web page


FileDateTime Click here to download the ZIP file: Get/Set File Date/Time project
-      -      -      -      -      -      -      -      -      -      -
use API calls to get and/or set all three file date/times (creation, modification, and access)


FSO Documentation Click here to download the ZIP file: ZIP of MS Word doc
-      -      -      -      -      -      -      -      -      -      -
This document is the product of a utility that basically does what the object browser does, except that it has printout capabilty. This is the output from running it on the "Scripting Runtime DLL" which contains, among other things, the File System Object (FSO), so this doc shows all the methods and properties and so forth of the FSO. Although it does not give any more detail than the object browser does, at least you can see everything at one time and visually crossreference methods and properties. I found it invaluable while I was learning the FSO.


Floating Point Math "errors" Click here to visit the thread: binary fractions
-      -      -      -      -      -      -      -      -      -      -
various VB forums occassionally have posts asking about apparent errors in simple floating point math, because some folks either do not understand that computers use binary numbers not decimal numbers or they have not thought through the ramifications of that fact. Conversion between binary and decimal whole numbers is precise and does not lead to confusion and this lulls beginners into a false sense of security regarding the ability of computers to represent numbers "exactly", but floating point numbers cannot always be represented exactly in one radix or the other and this causes results that sometimes seem surprizing to the uninitiated. The entire concept is covered in detail in referenced thread. It should be noted as you read the thread that an early entry incorrectly states that the floating point number 1.0 is not precisely represented in binary --- that is corrected later in the thread.


FTP file up/download Click here to download the zip file: FTP sample project
-      -      -      -      -      -      -      -      -      -      -
This fairly simple FTP app shows how to upload and download files and how to grab the contents (file names and folder names) from an FTP site. This is a downsizing of an original FTP app that I got from Planet Source Code. I have simplified it and added comments. The original is much more extensive, but also somewhat hard to follow. If you'd like to have it as well, click here:
FTP original project


parser Click here to download the project ZIP file: parser project
-      -      -      -      -      -      -      -      -      -      -
A sample project showing how to do a parser for HTML and XML type scripts. This sample project is moderately simple-minded, using only a handfull of HTML tags and having several caveats on functionality, but it shows HOW to do a parser, and can be extended to do more.


pointers Click here to view the doc: pointers
-      -      -      -      -      -      -      -      -      -      -
This is an excellent tutorial on pointers & other "secret" stuff in VB


Qsort Click here to view the sub: quicksort subroutine
-      -      -      -      -      -      -      -      -      -      -
This VB sub does a quicksort on a variant array but it is trivially easy to modify it to run on any data type. Actually, it will run as is on any normal data type array, as is shown by the accompanying test routine that uses an integer array, but there would be some efficiency in changing the variant to a specific data type since variants are relatively slow in VB.


Random Distribution Click here to download the project ZIP file: random distribution project
-      -      -      -      -      -      -      -      -      -      -
This VB project creates a set of integers with random distribution. The question of how to do this seems to come up about once a week on one of the various VB forums I look at. This is NOT a list of random numbers but rather a list of unique numbers (0 to 9 in the specific example) each used once but ordered randomly.


SANDBOX Click here to download the project ZIP file: phinds sandbox
-      -      -      -      -      -      -      -      -      -      -
This is a sandbox I created when first learning VB. It's a mess, but is has just a TON of stuff in it. Here's a partial list of what it has and where it is (this list is VERY incomplete):


sort algorithms click here to go to an excellent thread on sorting algorithms: sort algorithms #1 and here's another one: sort algorithms #2


Word Click here to download the zip file: MS Word doc and VB project
-      -      -      -      -      -      -      -      -      -      -
This MS Word document and an accompanying VB project, was lifted off of a forum. It shows some of the basics of MS Word automation from VB.






useful links (other VB sites)


all api an excellent source of information about programming the Windows API from within Visual Basic

API web site excellent web site for info on the API calls

CodeGuru FAQ VB "Frequently Asked Questions" --- excellent, especially for newbies.

codeguru files Visual Basic source code at the code guru site

juicy studio VB code samples and discussions that are presented together to form mini-tutorials on a number of fundamental topics in VB. This is an outstanding site for beginners

Excel VBA effeciency tips on more effective Excel VBA code

freevbcode VB source code sorted by both topic and level of difficulty --- each topic has the following subtopics: beginning, intermediate, advanced, snippets, applications, classes, controls, modules (although not every subtopic is populated for every topic, it is quite extensive)

file formats 1 a web site (filespecs.com) that gives the formats of most common file types

file formats 2 a web site (wotsit.org) that gives the formats of most common file types

GalahTech VB code snippets and examples; I haven't checked this one out

Karl E. Peterson "Karl E. Peterson's One Stop Source Shop". Something less than 100 projects, but many of them fairly extensive, with source code.

planet source code This is fairly widely considered THE source code site for VB (and other languages). It has a very wide variety of projects and a huge amount of source code. It currently boasts some 2,700,000+ lines of VB source code. It allows you to restrict your search to code only supported by various versions of VB from 3 to 6 and with other categories as well (ASP, script, etc) and includes topic areas such as: Coding Standards, Complete Applications, Custom Controls/ Forms/ Menus, Data Structures, Databases/ Data Access/ DAO/ ADO, DDE, Debugging and Erro Handling, DirectX, Encryption, Files/ File Controls/ Input/ Output, Games, Graphics, Internet, Libraries, Math/ Dates, Microsoft Office Apps/VBA, OLE/ COM/ DCOM/ Active-X, Registry, Sound/MP3, String Manipulation, Windows API Call, and more

resource files a web page showing how to use resource files in VB

VB Internet Programming a site devoted to Internet programming in VB

A1 VB code another source code site for VB programmers. Not as extensive as PlanetSourceCode, but then what site is? Includes the following topics: Active Server Pages, ActiveX, Controls, Databases, Date/Time, File Manipulation, Forms, Game Programming, Graphics, Internet Programming, Mathematics, Networking, Security, String Manipulation, Windows APIWindows Registry, and more

vbcode Visual Basic source code snippets and project files

VB explorer a site mostly for beginners (it says) with lots of tutorials and stuff