Copyright: Source Code Tool Box


Source Code Tool Box

What is it ?

Tool Box Projects

Alarm and WakeUp

Bad Icons

Batch Database Update

Load BitMap Database

Boilers Football Schedule

DDE as a Debugging Tool

Pop Up Calendar

Source Code Librarian

Common Dialog Examples

Combine Many Files into 2 Files

Generic Database Compactor

Mass VB Project Compiler

Scan Source Code for Copyrights

Convert an dBASE File to An Access Table

Database Record Counts

Database Date Processing

Generic Database Table Record Deleter

Data Control Form Designer

Load a Grid from a Database or Data Control

Load Icons into an Access Database

Load an Access Database into an Outline Control

Print Access Tables and Indexes

Print dBASE Tables and Indexes

Load Combo Box from State Database

View Database Objects using Object Variables

View Database Objects using a Data Control

Simple Data Control Maintenance

Complex Data Control Maintenance

Load Icons into a Data Control

Phone Rolodex using a Data Control

Example of using DDE in Debugging

Enhanced Outline Control Drag and Drop

Drag and Drop files from File Manager

Duplicate any Access Table

Dynamically View any Access Table

Dynamically Execute SQL Statements

Application Path API Examples

Update Last File Used List

How to show a Screen during a long Running Activity

How to use a Panel as a Status Meter

Editable Grid and Graphing Grid Contents

Grid Loaded from a Data Control

Animate Minimized Icons

View Icons and Convert icons to BitMaps

Dynamically Create an Access Database, Table and Index from VB Code

Comprehensive Demo of Graphing Control and Crystal Report Writer with an Access Database

Load the Samples Database

Load the States Database from a Text File

List Box with Tabs and Horizontal Scroll Bar

User Friendly List Box

List Box Loaded from a Data Control

Transfer items between List Boxes

Lotto Random Number Generator

Load the Samples Database

Message Box Code Generator

Load LDemo Demo Database

Outline Control Methods, Properties and Events

Parameter Query Example

How to Implement Passwords via an Access Database

Pop Up Menu Code Generator

Print VB Source Code in a Formatted Manner

Demo API's for INI file Access

Screen Saver Demo

Scan Source Code for Literals

Transfer Items Between List Boxes

BitMap Slide Show

Access Database Speed Examples

How to use Drag and Drop to Resize Controls

Simple SQL Statements Examples

Load State Abbreviations and Names from a Text File

Dynamically Update a Status Message as a User Navigates your Application

Test Path and File Existence

Set the Windows Time

Unpack Combined Files

Update the project Database

Access a dBASE Phone Database using the Data Control

 Who wrote it ?


What is the Source Code Tool Box
What is the Source Code Tool Box?

It is a collection of Visual Basic applications which demonstrate a variety of programming techniques. The techniques demostrated have been utilized in both commercial and shareware applications. The Tool Box includes all source code. You get modules, forms, projects (MAKes), databases and everything else.

It's basic purpose is to provide a large set of examples which you may use to develop simular applications. You are encourage to experiment with these projects and to modify them to expand your knowledge. Most projects focus on a specific topic, but supporting code usually contains valuable techniques as well.

Most craftspeople have a tool box or bag of tricks which they use as they ply their craft. Hopefully, you can use this as a basis for you own personal tool box. In particular, one of my major objectives was to provide a large collection of Access Database examples. I have included both data control and object variable implementations of database applications.


Alarm and WakeUp

The Alarm project is a database maintenance application. We use this project to enter events or appointments. The date and time for the events are validated during entry. You can add, update, delete and find events and appointments. You can also determine if this event was notified.

The WakeUp project is a timer application which is run from the Windows Startup Group. This application opens the database and checks for upcoming appointments and events. The user can set parameters for the wakeup. These parameters are stored in an INI file. When an event or appointment is detected the user is notified.


The Windows StartUp group is the group of applications which are started when you start Windows.


The Bear Hug

The Bear Hug is Houston, Texas based company. We specialize in custom windows applications. We are available on a consulting basis for both short and long term projects. We provide training, conversion, software installation, application development and application maintenance.

The Bear Hug

1031 Waltway

Houston, Texas 77008


Bad Icons

The BadIcons project is a utility application which will test all icons in a specified path. All bad icons will be loaded into a list box. You may then delete the bad icons. When minimized, the application will display a number of weather related icons.


Batch Database Update

The Batdbup project is a sample application which Shells a Dos DIR command of the files specified in the text box. While the Dos command is executing we are monitoring it's execution with the GetNumTasks Windows API. Prior to running the Dos command, we create an Action Query which removes all the records from the database. Then the program reads the resulting text file and loads an Access Database.


Load BitMap Database

The BitMap project is a sample application uses the DIR function to load a database with all projects in the specified path.


Boilers Football Schedule

The Boilers project is an application that demonstrates the use of control arrays, timers and icon animation.


DDE as a Debugging Tool
Using DDE as a Debugger

The Bugger and Sender projects work in tandem to demonstrate the usage of DDE. The Bugger project must be compiled to an EXE. Next you load the Sender project and run the project. Simply enter data into the text box and press the SEND button. The send program will send the text to the Bugger.EXE via DDE. Now press the end button or CTRL BREAK to end execution. Unlike the VB debug window the data remains in the Bugger Text Box. This technique allows significantly improved debugging sessions. To add this type of debugging to any application you must add Text Box to your application. During runtime set the following properties.

text1.LinkMode = link_none

text1.LinkTopic = "Bugger|Bugger"

text1.LinkItem = "text1"

text1.LinkMode = link_manual

Once you have loaded data into the text box, you simply execute the following method.

text1.LinkPoke

The data will be sent via DDE to the Bugger text box.


Popup Calendar Form
Pop Up Calendar

The Calendar and TestCal projects demonstrate how to use the popup calendar. The Calendar projects shows the calendar format. The TestCal project is an example of how to use the popup calendar in you applications. You must add 2 files to your existing project, add Calendar.BAS and Calendar.FRM to you application. The calendar can be passed an input date. There are several possible return values and formats. Simply show the Calendar form on a Double Click of a text box. The user may scroll thru years and months and only need's to click on the date of their choice. The calendar form is accomplished thru the use of control arrays.


Lower, Upper and Normal Case

The Case projects demonstrate how to allow uppercase entry only and convert from any case to normal or name case. These projects also demonstrates how to restrict entry to numeric values only. In addition, it demonstrates how to make the enter key TAB to the next field.  The KEYPRESS event is used extensively in this application. This project also demonstrates how to use the HideCaret and ShowCaret Windows API.


Source Code Librarian

The CodeLibr project is an excellent utility to assist your coding speed. You can add all your most frequently used routines to the Librarian. Then as you are coding and want to use a predefined technique you simply copy the code into you application. This application demonstrates how to do simple database maintenance.


Common Dialog Examples

The ComDLG01 project demonstrates how to use the Windows Common Dialogs for File, Color, Font and Printer support. In addition, it includes the most commonly used Flag settings.


Generic Database Compactor

The Compact project is a generic database compactor. It can be used to compact any Access database. This utility is extremely usefull when disk space is at a premium.


Convert a DBase File to an Access Table

The Convert1 project is an example of how to convert a DBase file to an Access table. It also demonstrates how to read data from a Data Control and write data to an Table object variable.


Database Record Count

The DBCOUNT project is a database utility which retrieves the record counts for each tabledef in the selected database. These  record counts are loaded into a sizable grid. A print option is provided on the menu which generates a PRINTFORM. This application provides a simple demonstration on how to loop thru the tabledefs. It also provides an insight on table attributes.


Database Date Processing

The DBDATEP1 project is a database example which utilizes a data control. It demonstrates how to use various date formats, DatePart function, DateDiff function and DateAdd function. These new functions are simple to use and extremely powerful.


Database Table Record Deleter

The DBDelete project is an excellent database utility which can delete all the records of any table in any Access database. This application also demonstrates how to create a QueryDef based on variable data and how to execute it.


Data Control Form Designer

The DBFMDESN project is an utility to assist your creating database applications. First you select a database to process. Next, you select a table to process. After selecting a table, two windows appear. the first is a layout form and the other is a database field form. Simply select the field heading option. No headings, left or above the field placement are the options. Then you drag the field to the layout form, dropping it where you want it placed. The fields can be moved if you prefer another location. When you are finished drawing your form you save the form from the file menu. Next a form with a data control bitmap will appear. Simply drag the data control bitmap and drop it on the layout form. Next name your new form and try it out.


Load Icons into a Database
Loading Icons into a Database

The DBIcons project is an example of loading icons into a database object variable. You cannot directly load an icon or bitmap into an database object variable. However, you can copy an icon or bitmap from a data control into a database object varable. So all you need is a one record data control. You then load the icon or bitmap into a bound Image control. Next, you execute a move to cause an update to the database. Now all that's needed is to load the data control variable into the database object variable.


Loading Database records into the Outline Control

The DBOUT project demonstrates how to load a database into an outline control. It also demonstrates how to handle indentation levels based on database fields. It also demonstrates how to uses the HideCaret and ShowCaret Windows API.


Prints Access Database Fields and Indexes
Print Access Database Fields and Indexes

The DBPRINT project is an excellent utility to allow you to document you database tables and indexes. After selecting a database file, this application will cycle thru the tabledefs and load them into a list box. Then you select one or more tables to print. Check the index box if you want the indexes to also be listed. When you press the List button the program will execute a ListFields to a snapshot and print the fields. If you checked the Indexes box, the program will execute a ListIndexes to snapshots and print the indexes.


Prints dBase IV Database Fields and Indexes
Print dBase IV Database Fields and Indexes

The DBPRINTD project is an excellent utility to allow you to document you database tables and indexes. After selecting a database file, this application will cycle thru the tabledefs and load them into a list box. Then you select one or more tables to print. Check the index box if you want the indexes to also be listed. When you press the List button the program will execute a ListFields to a snapshot and print the fields. If you checked the Indexes box, the program will execute a ListIndexes to snapshots and print the indexes.


Load Combo Box with States Database

The DBStates project is an example fo how to load a combo box from a table. This example loads both states and their abbreviations.


Database Objects Viewer using Database Object Variables
Database Objects Viewer using Object Variables

The DBView1 project is an excellent example of using database collections. After you select a database file, the database is opened and the tables are loaded into a list box. When you doubleclick a table it's Fields and Indexes collections are loaded into list boxes for viewing. This is a simple application to use as a basis for understanding database collections. All list boxes in this application use tab stops (SendMessage) to present data.


Database Objects Viewer using a Data Control

The DBView2 project is an excellent example of using database collections. After you select a database file, the data control is set to the database file and the tables are loaded into a list box. When you doubleclick a table it's Fields and Indexes collections are loaded into list boxes for viewing. This is a simple application to use as a basis for understanding database collections. All list boxes in this application use tab stops (SendMessage) to present data.


Simple Data Control Maintenance

The DC1 project is an example of a simple Data Control maintenance application. It includes code in the data error, reposition and validation procedures. In addition, it includes a Find form to allow the user to find records. The Find is implemented using a Clone of the data control. This is done to prevent application flicker as the system performs a FindFirst. This application also demonstrates how to use the Like operator.


Complex Data Control Maintenance

The DC2 project is a uses seven data controls on 2 forms to maintain and view application data. In addition, it includes a Find form to do database searches. During the data control Reposition  event the main record does a lookup on two linked tables in order to retrieve category and project descriptive information. When the use doubleclicks on the Category or Project Text Boxes list boxes of available selections are provided. When the use doubleclicks on the shaded portion of the form a detail history from is show. This form displays history data in a grid control. This grid control is also loaded from a data control.


Load Icons into a Data Control

The DCBitMap project is an example of how to load icons into an Image control which is Bound to a Data Control. When the Insert button is clicked an Icon Viewer form is displayed. This form demonstrates how to synchronize a Drive, Directory and File list box. It also demonstrates how to synchronize a File list box, Horizontal Scroll Bar and Picture box. After an icon is selected (saving its name) it is loaded into the bound Image control. Any subsequent move operation causes the image to be saved into the database.


Phone Rolodex using a Data Control

The DCPhone project is an example of using a Data Control for a phone rolodex. It includes a Find form to search for specific names. In addition, it demonstrates how to utilize the UpdateControls method to undo changes.


Example of Using DDE in Debugging

The DDETestr project is an example how you can add the Sender form to a project for enhanced debugging. This application also demonstrates how to manipulate objects which reside on other forms.


Enhanced Outline Control Drag and Drop

The DragOut1 project demonstrates how to load an outline control and how to implement drag and drop. As the picture is dragged over the various items in the outline control, the ListIndex or highlighted item is reset. The item the drag icon is over is calculated by using the Y value provided by the DragOver event and the height of the outline control font.


Drag and Drop files from File Manager

The DropFile project is an example of how to access files dragged and dropped  from File Manager. First the application places the window on top of all other windows by using the SetWindowPos API. Next the application must notify windows that it can accept files from File Manager by using the DragAcceptFiles. Now the application goes into a loop looking for File Manager file drop (PeekMessage). When a File Manager drop is detected, we can ask for a count of the files dropped and then we can get the file names by using the DragQueryFile API. When all the files have been processed then we can inform File Manager that we have finished with the dragged file structure and we resume our loop waiting for files to be dropped.


Duplicate any Access Table

The DupTable project is a database utility which will take any Access table and copy it. It will also create the new database if necessary. This application will loop thru the Fields collection and the Indexes collection and use these in creating a new table. Next it will duplicate the data to the new table.


Dynamically view any Access table in a Grid

The DynaGrid project is a database utility which allows you to view the contents of any Access table. It will automatically load all fields in the table and will load up to 2000 records. This program uses a Snapshot to load the table fields.


Dynamically Execute SQL Selects and View the Results

The DynaSQL project is a database utility which allows you to test SQL select statements dyanamically. First, you select a database. Next you key a select statement and view the results. If the SQL was atisfactory then you may copy the SQL statement to the clipboard for subsequent pasting in your applications. This program uses a Snapshot  to load the fields and data into a Grid.


Application Path API Examples

The EXEPath project demonstrates how to determine the application path, windows directory and windows system directory. These are relatively simple Windows API's to call. These paths may  be useful in locating various objects.


Extended multiple selection.  Shift+click or Shift+arrow key extends the selection from the previously selected item to the current item.  Ctrl+click selects or deselects an item in the list.


Update Last Files Used List

The FileList project demonstrates how to update a last files used or open list on the menu. First,  you start with a seperator menu item and a control array of four menu items. The should all be  invisible. When the form loads, it should look in an INI file for the most recently used files. If it finds any files it should load then and make them visible. As new files are created and existing files are opened you must append or promote the files in the files list. For instance, if a file already exist as the 1st file from the last time you ran the application and you open it again then the file list should remain the same. Or, if a file exist as the 3rd file and you open it then the file should be promoted to the 1st (most recent) and the others should bubble down. If you have 4 files in the file list and you open a new or different file then the most recent file should be 1st and the other should be demoted or removed. When the form is unloaded then you should record the current file list into an INI. While this seems like a simple function, the coding can be tricky.


Flash Screen
How to Flash a Screen during Long Running Activities

The Flash12 project is an example of how to quickly get a screen up during a long process like application startup.


How to use a Panel as a Status Meter

The Flood1 project is an example of how to create a percent complete status meter. Simple place a Threed Panel control on a form. Then set the FloodPercent as the project task get completed.


Editable Grid and Graphing Grid Contents

The GrafGrid project is two examples in one. First, it demonstrates how to make the Grid control appear to be editable by using a floating Text Box. Second, it demonstrates how to graph the data in a Grid. A combo box of various graph types allows you to view the graph in a variety of formats. The graph can also be printed. The demo data is dynamically generated by using the RND function.


Grid loaded from a Data Control

The Grid4 project is an example of how to load a Grid using a data Control. It also demonstrates how to retrieve data from the grid after a cell has been clicked.


Animate Minimized Form Icons

The IconMin project is an excellent example of how to animate the icon of a minimized form. A timer is used to switch the icons. The Form's icon is replaced only if form is running minimized (Windowstate = Minimized).


View Icons and Convert Icons To BitMaps

The IconView project is two projects in one. First, it will save any icon as a BitMap. Second, it is an icon viewer which allows you to browse thru a directory of icons by using a scroll bar. In addition, it demonstrates how to synchronize a Drive, Directory and File list box. It also demonstrates how to synchronize a List Box and a Horizontal Scroll Bar.


Dynamically create an Access Database, Table and Index
Dyanimcally create an Access Database, Table and Index

The Inven1 project is an example of how to create  Access database objects from VB code. First, it creates a database object. Next, it appends a field to the new TableDef. Then, it appends the new table to the database. Next we append the balance of the fields. This is done in this manner because a field object can only be used once. Therefore in order to prevent a field object variable for every field we loop thru the fields and append each field then close the database. Closing the database frees the field object variable. Then we append the indexes. At this point you are ready to load the database with data. This project also demonstrates how to retrieve information from an INI file (GetPrivateProfileString) and how to get the windows directory (GetWindowsDirectory).


Demo of Graphing and Crystal Reports using an Access Database

The LDemo project is a comprehensive example of how to create an effective VB demo fro a prospect or customer. This demo creates a variety of business graphs. Each graph allows selection of a year or date range and a variety of graph types (Bar, 3D, Pie Chart). The date range form also provides an access to the Calendar popup for date selection. The demo also includes two reports. Both can be viewed in window or printed. The first report is a sample order form which includes a company logo bitmap. The second report is a summary report for a date range. In addition, this application uses tab stops (SendMessage) in it's List Box.


Load the Samples History Database

The LdSamphs project  uses two data controls. First, it deletes records from the Sample History database. Then, it add news records with today's date. It also uses transactions to speed processing.


Load the States Database from a Text File

The LdStates project is an example of how to load an Access database from a text file. First, it deletes any existing records. Next, it opens the text file and uses the MID$ function to extract the individual data fields. Then it writes the new records to the database. We used transactions because they increase database loading speed.


List Box with Tabs and Horizontal Scroll Bar

The ListBox1 project demontrates how to set the tabs in a List Box and how to add a hozizontal scroll bar to a List Box when the data exceeds the width of the control. Both of these methods require the sending of a message to the list box control. The SendMessage windows API is perhaps the most frequently used API by VB programmers. The SendMessage API has 4 parameters: hWnd - handle of the window to receive the message; wMsg - Message ID; wParam - 16 bit parameter which varies by Message ID; lParam - 32 bit parameter which varies by Message ID. When a programmer wishes to set the tabs in a list box, they must first create an array which includes on entry for each tab position. The tab positions are set in dialog units of measure. A dialog unit is approximately 1/4 of a character. Therefore, to set the tabs at 12 and 52 characters we must have an array with a(0) = 48 and a(1) = 208 (4 x 12 = 48; 4 x 52 = 208). Next, you issue a SendMessage to the list box telling it to set 2 tabs and pass it the array. To implement a horizontal scroll bar your must determine the width of the data to viewed in the list box. The simplest method to do this is to get the Textwidth of a row of data. Next, you issue a SendMessage to the list box telling it the width to set. The second parameter is not used when setting the list box scrolling width. Perhaps the greatest mistake made by programmers implementing horizontal scroll bars is the impact of tabs. For example, if the tab is significantly beyond the data and we use the actual data to compute the textwidth then a fudge factor must be added to compensate for the space between the data and the next tab stop. No damage will occur if the Horinzontal Extent is significantly wider than the data. So when in doubt, make your horizontal extent wider than the data it contains.


User Friendly List Box

The ListBox2 project is an example of how to make a List Box easier to use for a user. If the list box caontained a significant number of entries a user might have to do a substantial amount of scrolling to reach their data. However, if we place a positioning text box then a user could key a 'S' for example and we could position the list box at the data that starts with an 'S'. to highlight an entry in a list box we set that entry's Selected property to True. To set the top entry for a list box we set the TopIndex to the item we want placed at top.


List Box loaded from a Data Control

The ListBox4 project is an example of how to load a List Box from a Data Control. The technique is quite simple, first attach a data control to the table you want. Next, position yourself to the first record by using the MoveFirst method. Now, loop thru the recordset adding each entry to the list box and moving to the next record via a MoveNext. This project also demonstrates how to find a specific record based on the record clicked in a list box. The ListIndex property is used to extract the data from the List property. Then we use the data from the list box to create a search string for the FindFirst method.


Transfer items between List Boxes

The ListBox5 project is an example of how transfer a selected items from one list box to another. A user can select one or more items and press the '>' or '<' button to transfer the selected items to the other list box. The user can also press the '>>' or '<<' button to add all the items to the other list box. The MultiSelect property of the list boxes are set to 2 or Extended Selection.


Lotto Random Number Generator

The Lotto project is an six unique (RND) number generator for playing the Texas Lottery. It can easily be modified to accomodate fewer or more numbers. It can also be changed to allow duplicate numbers.


Load Make Database
Load Sample Database

The MakeLoad project is used to load the Sample Database. First, it loads the MAK's into an array. Then, it opens the MAK and looks for BAS and FRM files. It then loads them to the Sample Database.


Message Box Code Generator

The MSGBOXMK project is an excellent utility to assist you in coding Message Boxes. You can select the options you want  and can then press the 'Load'  Button to see the results in a Message Box. When you have finished your refinements, you can copy then generated code to the ClipBoard and insert the code into your application. This program builds both MSGBOX statements and functions.


Load Demo Database
Load LDemo Database

The OrderHLD and OrderDLD projects build the demo data for the LDemo project. First, OrderHLD project loads the order header file data. This demo uses the RND function to generate its order data, the DateAdd function to generate the order date and the CHOOSE to select the customer number. The second project OrderDLD loads the order detail file data. This project reads the order header file and generates test data for each order. The number of order detail lines for an order is determined by RND function. We also use the RND function to determine the order quantity and order price. We use the RND and the CHOOSE function to determine the order detail product. These methods provide a fast and easy method for building either demo or test data. These methods also are useful for analyzing database performance by providing large volumes of data.


Outline Control Methods, Properties and Events

The OutDemo1 project is an excellent example of how to use the outline control. It includes several outlines. The Indent property is demonstrated by providing several levels on the outline control. The Expand property and method are also demonstrated. By looking at Expand property of an item we are able to determine if it is expanded or not. By setting the Expand property to its complement we are able to toggle it between expanded and not.


Parameter Query Example

The Parametr project is an example of how to execute a parameter query via VB code. Parameter Queries provide a simple implementation of reusable SQL statements. Once created, the Parameter Query only needs to be opened (OpenQueryDef) and it's paramters set. Parameters are set by assigning a value to PARAMETER field(s) of a QueryDef (i.e. MyQuery!FileParam = TXT_FileName.Text). Now, the query can be Executed or used to create a Dynaset or SnapShot.


How to Implement Passwords via an Access Database

The Password project is an example of how to use a database to determine a users authority level. First, you can use a database to validate the password for each user. If a matching password is not found in the database then the application may ended. This example allows three bad password attemps. By using flags or fields you can set the user's access to your application. Menus provide an excellent means of implementing this security. Menu items can easily be enabled or disabled in code.


Pop Up Menu Code Generator

The PopMenu project is a code generator which allows you to select X and Y coordinates, Relative X alignment, and the button selected for a Popup Menu. When you press the right mouse button a popup menu is display based on your selection values. In addition, the menu popup code is generated and placed in a Text Box. This application supports the Clipboard so you may copy the code to your application.


Print VB Source Code

The PrintPro project is an excellent utility to assist you with your source code printing. First, you select a project to print from. Next, you select a one or more forms or modules to print. The Print Form Text check box determines if the properties for controls on forms is printed or not. All procedure and functions print in bold font. All comments print in italics font. In addition, the file name, print date and page are printed on each page as a conveniece.


Demo API's for INI file access

The Profile project demonstrates the windows API's that can be used to access the windows INI file (WIN.INI) and application specific INI files. This application demonstrates how to retain the size of an application window and it's windowstate. In addition, it demonstrates how to store application specific data like program and data directories. It also demontrates how to retrieve data from the windows INI file by retrieving your current wallpaper choice.


Screen Saver Demo

The ScrnSave project is a demo of how to write your own screen saver. Screen saver applications have some very unique requirements. First, they must end have the extension SCR. Next, they must be capable of distinguishing between a variety of startup command strings. If the program is started with a '/C' then a screen saver configuration screen should be displayed. If the program is started with a '/S' then the screen saver program should execute is screen saver functions. Whenever a key is pressed or a mousemove occurs the screen saver should end. In addition, it is the programmers responsibility to place the screen saver on top of all other windows. Perhaps the most challenging part of dealing with a screen saver is its requirement to end if a mousemove is detected. However, as you are aware, mousemoves can occur without the mouse moving. This is also the case during screen saver execution. In order to prevent your screen saver from ending prematurely, it is advisable that you record the original mouse position and then compute it's move distance. Once this move distance is substantial you can end your application. Don't forget that you must place the screen saver on top of all other windows (BringWindowToTop). One last point, a professional appearing screen saver should always hide the cursor. Hiding the cursor is not as simple as calling the ShowCursor API. If the API returns a number >= 0 then the cursor is still displayed. In order to hide it you must continue to execute calls to the ShowCursor API until the return value is < 0. This demo allows you to display a text string, graphic or both which are moved by a Timer and a RND function. This project also demonstrates INI file reading and updating.


Scan Source Code for Literals

The Seeker project is utility to assist programmers in finding code examples and strings. After selecting a path, you may key the file types to process (i.e. FRM, BAS, MAK, TXT, etc.) and the sreach string to search for. The program then reads each file that meets the criteria for the search string. If the string is found, the file name is added to the list box. When you Double Click on the file list box the selected file is displayed in NotePad. The program then uses the SendKeys to initiate a string search in NotePad.


Transfer Items between List Boxes

The Select project is an example of how to tranfer items from one list box to another. One or more items may be selected and then the '>' or '<' may be pressed to transfer data. All records will be transfered by pressing '>>' or '<<'.


BitMap Slide Show

The Slide project is an utility which displays all the bitmaps in a directory. Either pressing a key or doing a MouseDown causes the next bitmap to be displayed. To end the application either double click the form press the control key.


Access Database Speed Examples

The SpeedDB1 project is an example of how database methods vary in execution speed. Both speed examples remove records from the database and then add them. However, one removes the records by creating a querydef (CreateQueryDef) and then executing it. The other, simply executes (Execute) a SQL string with a delete statement. Both examples add records by using the AddNew and Update methods. However, one uses transactions (BeginTrans and CommitTrans) and the other does not. Time differences are computed using the DateDiff function.


How to use Drag and Drop to Resize Controls

The Split project is an example of how to use the DragOver event to resize a control. A blue picture box is placed between two text boxes. When the left mouse button is pressed over the blue picture Dragging is enabled. As you continue to hold the left mouse button down, you may move the double arrow icon to the left and right. While doing so the two text boxes are dynamically resized. When you release the mouse button dragging is complete and the text boxes retain their last size.


Simple SQL statement examples

The SQLTest project is an example of how to do simple SQl statements. A list box is provided with SQL statements. As you click on a SQL statement, the results of that statement are displayed in a grid. This example covers most of the basic SQl select statements. In addition, it contains a SnapToGrid routine which contains the code necessary to load any SnapShot into a Grid.


Load State abbreviations and names from a Text File

The States project is an example of how to load a combo box from a text file. In addition, it demonstates how to synchronize two combo boxes using the ListIndex property.


Dynamically update a Status Message as a user navigates your application

The Status project is a simple example on how to display status and informational messages without expensive third party controls. In fact, only standard edition VB controls are used. The key to providing status information is the MouseMove event. As the cursor is placed over labels, text boxes and command buttons you can use the MouseMove event to set the caption in a label control. In addition, as the mouse is moved thru the main menu items a Click event is generated and we can also use this to set the caption of a label control. Unfortunately, a Combo Box does not have a MouseMove event. One way to get mouse events around a combo box is to place a picture box beneath the combo box. Since we do get mouse moves on a picture box we can emulate the mouse moves for the combo box. How do we get a picture box beneath a combo box? Well, that's easy, a method called ZOrder allows us to determine the order of objects along the Z axis. The Z axis runs from your eyeballs to the back of your monitor. Objects with the lowest Zorder (0) appear on top and higher ZOrders appear in the back. Now, if any of your controls don't handle MouseMove events we just need to place a picture box beneath them.


Test for Paths and File Existence

The TestPath project contains two routines which can be used to determine path and file existence. Simply call the CheckPathExist function and pass it a path string to test. It will return true if the path exist and false if it doesn't. To check a file, simply call the CheckFileExist function and pass it a file string to test. It will return true if the file exist and false if it doesn't. Both of these functions use the FileDateTime function to determine existence. By evaluating the Err value after executing the FileDateTime function we can determine the error that was encountered.


Set the Windows Time

The SetTime project sets the time in windows. First, it loads the current hours, minutes and seconds by using the DatePart function of the current time (Now). Then, it uses the Spin Control to allow the user to increment or decrement the hours, minutes or seconds. Upon clicking the update button the time is set using the Time statement.


Update the Project Database

The UpProjec project is an example of how to copy parts of data from one Table to another and how to update existing records with new data. It simply, reads the input table and adds records to the output table if the records don't exist (NoMatch = True) and updates the records with the new descriptions if the records do exist (NoMatch = False).


Access a dBASE Phone Database using the Data Control
Accessing a dBASE Phone Database using the Data Control

The VBPhone project is an example of accessing dBASE data via the Data Control. The data control requires three properties be set to access dBASE files. The first is the Connect property which identifies the database type should be 'dBASE III'. The DatabaseName property should be set to the path of the dBASE files. The RecordSource property can either be set to the name of a dBASE table or an SQL statement (i.e. 'Select * from Phone Order By Name'). If the data control works fine while in VB design mode but fails to run when the executable (EXE) is run then you most likely need to provide the database engine with it's dBASE ISAM information. This is typically an INI file with the same name as the EXE that contains the ISAM data provided in the VB.INI file. The path to this file is set by the SetDataAccessOption statement.


Combine Toll Box Files
Combine Tool Box Files

The Comfile project is used to combine a large number of files into a data and index file for easier distribution. In addition, we can circumvent problems with the Setup process. Specifically, a FRM and FRX file will both compress to FR_. Therefore, they cannot both reside in the same project setup. In addition, rather than distribute 80 files we can just send 2 files.


Scan for files without Copyright Comments

The Copyright project is used to determine which BAS and FRM files do not have Copyright comments in them. A print option is provided.


Loading a Grid from a Database or Data Control

The DBGrid project demonstrates how to load the Grid control from either a Database or Data Control.


UnPack Combined Tool Box Files

The UnpackVB project is used to unpack files which have been previously combined by the Comfile project. This process uses a data and index file to unpack the files.  In addition, rather than distribute 80 files we can just send 2 files.


Mass VB Project Recompiler

The Compile project is used to recompile all or selected projects in a subdirectory. In order to run this EXE you must first end VB. Then select the MAK or MAK's you want to compile to EXE's. Then sit back and watch. This program will send the necessary key strokes (SendKeys) to compile you project.