Free Developer Articles and Source Code
 
Downloads
 

 

Sample Source Code : Visual Basic

File Description
appdoc.zip
6.09KB
Application Document Handling Control Demo [VB5]
This example program demonstrates how you can use a VB5 control to encapsulate the logic required for proper implementation of the New, Open, Save and Save As commands. The control helps keep track of the current document's name, whether or not it has been modified, and so on. Events are used to notify the application when the application-specific data needs to be saved to or loaded from disk. A small sample program demonstrates use of the control.
autodial.zip
2.6KB
Telephone Dialer Demo [VB5]
Demonstrates how an application can dial a telephone number under Win32 using Assisted Telephony which is a subset of TAPI. This code is simple because it relies on a call manager applet to perform the actual dialing.
autofill.zip
3.46KB
Auto-Fill Demo [VB5]
Shows how to implement an auto-fill combo box that works like the ones in Microsoft Money or Intuit's Quicken. As characters are typed, the program finds the closest matching item from the list and automatically fills in the remaining characters. Appended characters are highlighted so that they are replaced by any further typing. A similar approach can be used to work with a text box and list box control.
bitarray.zip
4.99KB
Bit Array Class Demo [VB5]
Demonstrates a bit-array class. If you need to store a large number of simple True/False, Yes/No, or 1/0 values, this class can result in significant memory savings by using only a single bit to store each value. This code uses data abstraction to make the syntax for accessing bit values just as simple as the syntax required to access values in traditional arrays. Also includes routines to save the data to disk and read it back.
browse.zip
4.22KB
BrowseForFolder Demo [VB6]
Demonstrates use of the SHBrowseForFolder API function by providing a "wrapper" function and a simple test form. BrowseForFolder allows the user to select a path by browsing the directories on their system.
calendar.zip
5.17KB
Calendar Demo [VB5]
Demonstrates how to create a small calendar in Visual Basic. Users can select a date from the calendar using the keyboard or mouse. This example program takes advantage of the changes made to Visual Basic 4.0, which allow forms to have public methods and properties. Although the code to implement the calendar is non-trivial, using the calendar requires only calling a single method.
clipcurs.zip
2.61KB
Cursor Restriction Demo [VB5]
This code demonstrates how to use the Windows API to restrict mouse cursor movement to a rectangular region on the screen. It also shows how you can move the mouse cursor from code.
contacts.zip
7.65KB
Contact Manager Demo Program [VB5]
This example program demonstrates how to implement a rudimentary contact manager in Visual Basic. You can add any number of names and phone numbers, etc. Although this program is extremely simple, it is provided as a foundation that you can use to begin development of a more sophisticated contact manager of your own, or as a guide for beginner-level programmers.
custmcap.zip
3.62KB
Custom Caption Demo [VB5]
This code shows how to create a form with no title bar (caption) and then either allow the user to drag the form by placing the mouse anywhere inside the form, or draw a caption of your own and allow the user to drag the form by your custom caption.
digits.zip
6.4KB
Digits Demo [VB5]
This Visual Basic demo shows how you can create a digital display that appears like some sort of electronic LCD/LED display, and includes several bitmaps that you can use to create such displays. You will need the PicClip control that ships with the professional edition of Visual Basic in order to run the demo program.
encrypt.zip
3.3KB
Encryption/Decryption Demo [VB5]
This Visual Basic example program demonstrates a very simple encryption/decryption algorithm. Although the algorithm is very simple, it makes use of a password to provide a reasonable level of security for non-critical applications.
eval.zip
8.92KB
Expression Evaluator Demo [VB5]
This code demonstrates using VB classes to create an expression evaluator. An expression evaluator takes algebraic expressions such as "8 * ((5 - 2) * 4)" and returns the result, in this case, 96. Support for variable names within the expression is also provided.
floattbr.zip
8.87KB
Floating Toolbar Demo [VB5]
This program demonstrates how to create a floating toolbar in Visual Basic. The primary requirements for the toolbar was that it sits "on top" of the main window without necessarily sitting on top of windows in other applications. Also demonstrates code to display toolbar buttons from a single bitmap.
formdsgn.zip
8.35KB
Form Designer Demo [VB5]
This example program demonstrates code that allows the user to move and size controls at run time much as Visual Basic allows at design time. The code implements sizing handles and a drag rectangle that appears as the user is sizing and moving controls. This version of the code works with most controls.
num2text.zip
3.36KB
Number to Text Demo [VB5]
This demonstration program shows how to convert numbers to English as you might see in a check writing program. For example, 12345.67 is converted to "Twelve thousand, three hundred forty-five and 67/100".
shfileop.zip
7.2KB
SHFileOp Class Demo [VB5]
This is a Visual Basic class that makes it easy to fully exploit SHFileOperation. SHFileOperation is a Windows API function that provides many options for copying, moving, renaming and deleting files. For lengthy operations, this function displays a dialog box that indicates the current operation and progress. This is exactly the same progress dialog box displayed by the Windows Explorer because the Windows Explorer also calls SHFileOperation. The many options include the ability to send deleted files to the Recycle Bin. Provides an easy way to manipulate files that is consistent with the Windows 95 shell.
sprsmtrx.zip
4.31KB
Sparse Matrix Class Demo [VB5]
Demonstrates how to implement a simple sparse matrix class. A sparse matrix is like an enormous 2-dimensional array that is mostly empty. Using a traditional two-dimensional array to represent a spreadsheet with 500 rows and 500 columns would consume memory for 250,000 elements. A sparse matrix class can provide substantial memory savings by storing information only for those elements that are not empty. This example uses data abstraction to provide the functionality of a sparse matrix with the same simple syntax required for traditional two-dimensional arrays.
subcls.zip
41.8KB
16-Bit Subclassing Demo [VB3]
The files in this package provide 12 examples of using a subclassing control with Visual Basic to intercept Windows messages. Emphasis is placed on those messages that result in functionality that cannot be obtained through Visual Basic alone. The MSGHOOK.VBX subclassing control is also included. This code was described in the article "Subclass Your Way Around VB's Limitations" [Visual Basic Programmer's Journal September 1995].
subcls32.zip
43.6KB
32-Bit Subclassing Demo [VB5]
32-bit subclassing control written in Visual Basic. A subclassing control allows Visual Basic programs to detect messages for which Visual Basic does not provide direct support for. Full source code to the control is included. Also includes 8 examples to demonstrate using the control.
systray.zip
18.0KB
System Tray Demo [VB5]
This program demonstrates how to display an icon on the system taskbar (tray notification area) under Windows 95 and later, or Windows NT 4.0 or later. Includes SoftCircuits subclassing control.
urllink.zip
5.68KB
URL Link Demo [VB5]
This Visual Basic example program demonstrates how to automatically load a user's web browser and point it to a particular web site. The code is implemented as a simple control. The URL can also specify a data file that has an extension that has been registered by an application on your system. The appropriate application is automatically loaded with the specified data file or URL.
waitcurs.zip
3.61KB
Wait Cursor Demo [VB5]
Demonstrates a class that makes it easy to set an hourglass or other mouse pointer during lengthy operations. This handy technique restores the previous mouse pointer automatically when it goes out of scope, even if an error occurs.
wordwrap.zip
5.43KB
Word-Wrap Demo [VB5]
This demo program demonstrates a technique for printing unformatted text to the printer. The code is implemented as a class module to make it easy to reuse the code in other projects. The code prints the text to the printer with word wrap, margins and page headers and footers. You can customize the margin settings and header text using the class's public members.