This is a collection of Visual Basic code that was submitted to patorjk.com between the years of 1998 and 2003. The collection was pretty popular and covered a wide range of topics. Most of these downloads are for beginners and intermediates, however, there are a few advanced examples in the bunch (see projects by Craig Jr and ones relating to the Windows API). Almost all of these examples will work fine on Visual Basic 5.0, however, I've only made sure that they work in VB6.
For those of you who don't know the history of patorjk.com, the site flourished between the years of 1998 and 2003, though due to Pat's personal commitments, updates to the webpage became less and less frequent. In 2007 the site was unceremoniously deleted by its host and all of its files were lost. What's listed here are the examples that were re-sent in by users or were recovered from archive.org. Anything marked '[Missing]' is still missing.
Planet Source Code.com has lots of searchable example programs and tutorials; E-Commerce Webopedia: ActiveX controls is a page of links, but not sure how good it is for VB; Tutorials. These tutorials contain step by step graphical guides to several visual basic programming concepts and tools. Programming Visual Basic.NET Dave Grundgeiger Publisher: O'Reilly First Edition January 2002 ISBN: 0-596-00093-6, 464 pages Published just in time for the first release of Visual Basic Studio.NET, Programming Visual Basic.NET is a programmer's complete guide to Visual Basic.NET. Starting with a sample application and a high. Start Visual Studio and create a new Visual Basic Windows Forms project. Add two buttons to your form. One button will be used to create a new Excel Worksheet and the other button will be used to Save the Excel Workbook. Before you start with the code, you need to set a Reference to your Excel libraries on your computer. You have to keep in.
If you aren't able to find what you need here, you can check out the main programming section for additional VB 6.0 code and tutorials.
Section | Description |
---|---|
AOL and AIM Add-ons | Examples relating to programming AOL or AIM add-ons. |
Fonts, Files, and Databases | Examples dealing with fonts, files or databases. |
Games | Examples on games or things game related. |
Images | Examples dealing with images or the manipulation of them. |
Internet | Examples that have to do with the Internet. |
Menus | Examples on dealing with menus. |
Special Effects | Special effect examples. |
Window Manipulating | Examples dealing with the manipulation of windows. |
Miscellaneous | Examples that don't fit any where else. |
Code Title | Author | Code Description | Download |
---|---|---|---|
Add Room To List (AOL6 and below) | myst | Add the memebers of an aol chat room to a list. | Download |
AIM PW Decrypter | beerbaron | Shows how to decrypt aim passwords. [written in 2001] | Download |
AIM Screenname And PW Extract | ChiChis | This code demonstrates how to extract AIM screennames from the registry and the decrypt the password. [written in 2000] | Download |
AOL Chat Room Hook Example | Craig Jasper, Jr. | Subclassing example that shows how to determine if a newly created AOL window is an AOL chat room. [Requires SpyWorks 6; Written in VB6; Created in Win2000; Only tested for AOL 5.0 Revision 205.103] | Download |
AOL Hot Keys Example | Craig Jasper, Jr. | An example that shows how easy it is to implement HotKeys for AOL using the SpyWorks WinHook control. [Requires a licensed version of SpyWorks 6 WinHook control - DWSHK36.OCX; Tested with AOL5 and AOL6] | Download |
AOL HTML Extractor | Craig Jasper, Jr. | An example to demonstrate how to get the HTML that is the basis behind AOL's RICHCNTL via the Windows clipboard, as well as how to extract the URL data via the Windows clipboard. [Tested on AOL 7.0 Revision 4114.256] | Download |
AOL4 Chat/IM/EMail Examples | Shadow-X | Three examples that show how to send text to chat room, send text in IMs, and send text in email. | Download |
AOL7 Chat Sender Example | Source | Shows how to send text to AOL7 chat rooms. | Download |
AOL7 Instant Keyword Example | Source | Shows how to visit a website via the toolbar icon, keyword window textbox, and then keyword window icon. | Download |
AOL7 Instant Message Sender Example | Source | An example that shows how to send an instant message in AOL7. | Download |
AOL7 Write EMail Example | Source | Shows how to send email in AOL7. | Download |
Auto Fader | Xhandar | This is a 1 - 20 color auto-fader example for AOL. [Requires Dwsbc36.ocx] [Samples dos32.bas and patorjkfaderv2.bas] | Download |
Elite textbox | patorjk | This shows you one way you can change how text appears in a textbox as it's being typed. | Download |
Fader Example | sungod | This is an example on how to make a fader program. It has a pretty cool way of preview fading the text. | Download |
Macro Font Example | patorjk | This is an example that shows you two different ways to display macro fonts for macro shops. | Download |
MailBomb Fixer Example | patorjk | This is an example of a mailbomb fixer for aol4. It shows you how to get the mail list then scroll down it checking the item's text with the item you want to delete. | Download |
Room Buster/Server Helper | Xhandar | This is an project showing how to make a room buster with a server helper. | Download |
Scrambler Game Example | martyr | An example on how to make a chat room scrambler. [Note: Example is missing files and no longer works] | Download |
Sir's AOL/AIM Example | SiR | This is an example project that shows you the basics on how to make an AOL/AIM program. [comes with the sir vb6 bas] | Download |
Subclass Chat Send | Craig Jasper, Jr. | An example of subclassing an AOL 6.0 chat room's Send button and detecting when the Enter key is pressed in the RICHCNTL. Created for a ccom program, so the chat room doesn't have to see all of your commands. [Requires SpyWorks 6; Written in VB6 with Service Pack 5 installed; Created in Win2000 with Service Pack 2 installed; Only tested for AOL 6.0 Revision 4097.10523] | Download |
Code Title | Author | Code Description | Download |
---|---|---|---|
Address Book DataBase | Brian Smith aka local | An example of how to create an address book. [patorjk.com VB Contest Winner] | Download |
Address Book Example | Eric Osterheldt aka Deep Arctic | An example on how to create an address book. | [Missing] |
File Explorer | rude | VB example of a file explorer. | Download |
File Associations (File Type Generator) | Adam T | Shows how to create file associations so when you double click a certain file type it will open in a certain program. | Download |
Font Explorer | Xhandar | Lets you easily view your system's fonts by using an explorer-like interface. | Download |
Font Loading Example | gozer | This example shows you how you can use win32 api functions to quickly load all of the fonts on your computer. | Download |
Font Loading Example | patorjk | This example shows you one way you can speed up the loading of the fonts through a list of them to a file, then checking to see if any new ones have been added. | Download |
Open and Save Text Files | patorjk | This is a pretty simple example. I made it because I get a lot of questions on how to open and save text files. | Download |
Random Access Example | Eric Osterheldt aka Deep Arctic | Shows how to open and save a file in Random mode. Commonly used for databases. | Download |
Code Title | Author | Code Description | Download |
---|---|---|---|
Frogger | John Harper aka Digital Rampage | A VB version of the classic video game Frogger. [patorjk.com VB Contest Winner] | Download |
High Score List Example | patorjk | This is an example I made to show you one way on how you can make a high score feature for your project. | Download |
Mine Sweeper Game Example | unknown | This is an example on how to make the popular windows game Mine Sweeper. | Download |
Rock, Paper, Scissors Game Example | Wiger | A rock, paper, scissors game example, shows how to use the Select Case statement. | Download |
Sort List by Scores | patorjk | This is an example that shows you how to sort a listbox by the score a player has (sort of like the ones in chat room scrambler games). | Download |
Tic Tac Toe | Eric Osterheldt aka Deep Arctic | This is an example that shows you how to sort a listbox by the score a player has (sort of like the ones in chat room scrambler games). | Download |
Code Title | Author | Code Description | Download |
---|---|---|---|
Add Scrollbars to a Picturebox | patorjk | This example shows you how you can add scrollbars to a picturebox. | Download |
Fade One Picture into Another Picture | patorjk | This is an example on how to fade one image into another image using vb code. | Download |
Icon Editor | Herman Liu | An example on how to make an Icon Editor in VB. | Download |
Image Map Maker Example | Xhandar | An example on how to create an image map maker (one that generates image maps for html coding). | Download |
Macro Converter | patorjk | This takes pictures and turns them into text (or macros). I had some people tell me they were having some trouble with the macro converting code in the source code section, so I thought I'd post up an example on a macro converter. | Download |
Mosaic Maker | patorjk | An example on how to make a photomosaic image with one image (sort of like the ones my mosaicer program makes excepts with only one image). | Download |
Palette Writer | Xhandar | Shows how to write microangelo palettes, microsoft aplettes, and adobe color tables. | Download |
Picture to HTML | patorjk | This is the source code to the 1.5 version of my picture to macro program. | Download |
Zoom-in on Pictures | patorjk | This is an example on how to zoom in on pictures. Sort of like how paint brush does with that little box. | Download |
Code Title | Author | Code Description | Download |
---|---|---|---|
Download File | matis | Shows how to download a file off of the internet from a VB program. [Requires the INet control] | Download |
Firewall Example | Dracula X | An example on how to create a Firewall. | Download |
FTP Program Example | Unknown | This is an example on how to make an ftp program. | Download |
Get HTML | matis | Show how to get the source to a website using the inet control. | Download |
IP Chat Example | KnoB | This is an IP chat that uses encryption to send data. Made in VB6. | [Missing] |
Multiple Client Messenger Server | Robert Cleaver | This is an almost complete example of a multiple client messenger server that shows all online users and allows you to instant message them. | Download |
SMPT Mailing Program | Sean Mckeown - kow | This is a simple version of how to make an smtp mailing program. | Download |
Web Browser Example | Garren aka Keith Escalade | Very nice example on how to make a web browser and how it works. | Download |
Code Title | Author | Code Description | Download |
---|---|---|---|
Menu Effects | dos | Shows you how to change the font and selection colors in a menu. Make sure and read comments in the example so you don't end up crashing VB. | Download |
Menu Effects | face | Another take on creating your own menu. This example uses vb forms and allows scroll out effects. | Download |
Menu Effects | Da Jokel | Another example on menu effects, this one doesn't involve subclassing. | Download |
Menu Effects | casper | Another example on menu effects, this one doesn't involve subclassing. | Download |
Run Menu Example | Synthesize | Shows how to select an item in another program's menu. | Download |
Code Title | Author | Code Description | Download |
---|---|---|---|
Draw Border With API | patorjk | This example shows you how to use win32 api to draw lines and how to draw a border with a certain thickness. | Download |
Form Background Fade | patorjk | All code in this example was rewritten. This gives your forms a cool fading top to bottom or Side to Side color effect. | Download |
HTML Desktop | Adam Wehmann | Very cool. Create your own little desktop. Read readme.txt file for more instructions/info. | [Missing] |
Moving Background Example | Synthesize | Creates a cool effect with a background that scrolls to the right. | Download |
Mouse Move and Click | Eric Osterheldt aka Deep Arctic | Shows how to set the mouse position and then cause a mouse click in that spot. | Download |
Multi-Line ToolTips | Craig Jasper, Jr. | This is an example on how to make Multi-Line ToolTips. | Download |
Rounded Border Example | Chris Neuner | Example showing how to create a form with rounded borders. | Download |
Shape a Form to a Bitmap | dos | Shows you how to shape a form to bitmap. | Download |
Code Title | Author | Code Description | Download |
---|---|---|---|
Api Spy | patorjk | This is an example on how to make a 32 bit drag and drop api spy. | Download |
Basic API Coder | Greenmonkey | An example showing how to create a code generating program for finding windows. Also shows how to make it so the program can read add-ins. | Download |
Code Generator For Window Finding | Eric Osterheldt aka Deep Arctic | Another example on how to create the code to find windows, this one however, can create the code in VB, VC++, and Delphi. | Download |
Dock forms in VB | shock | Shows how to align one form next to another one. | [Missing] |
Draw Pictures On Windows | patorjk | This is an example on how to draw an image onto another window. Like if you wanted to draw over an image on a toolbar of another program or draw over the button on another program. | Download |
Find A Window's Siblings and Children | patorjk | Shows you how to find all of a window's siblings and children. | Download |
Find Window Code Generator Example | patorjk | This is an example that shows how to create the code to find a window, just by knowing the window's handle. | Download |
Form Docking | Viper | Shows how to make it so you can drag two forms at once. Ex: When you drag form1, if form2 is attached, it will be dragged along with form1. | [Missing] |
Load From Old Position | Adam V. aka sabre | Shows how to load a program in the position it was in when it was last used. | Download |
MDI & Dialog Example | Eric Osterheldt aka Deep Arctic | An example showing how to use MDIs and dialogs that they can use. | Download |
Positions Example | Pio | Shows one use for registry entries. Move the form to where ever you want it, then click the x on the form. When you load it up the next time it will be where ever you closed it. | Download |
Visual Basic Examples With Source Code Free
Code Title | Author | Code Description | Download |
---|---|---|---|
Addition (The Hard Way) | Adam Wehmann | Performs addition on any two positive numbers. Is able to add numbers larger than 2,147,483,647 (the max range for a Long = '20'. [patorjk.com VB Contest Winner] | Download |
MCI Example | Matt Hart | An example on how to play mid files and avi files without custom controls. | [Missing] |
MouseOver MouseOut Example | gozer | This example was written to show the different ways of using the api of mouse move stuff in the mousemove event. Like creating detecting when a mouse enters and leaves the object. | Download |
MP3 Player | Jason Hensley | A basic example of using [Jason's] MP3 Class Module to create an MP3 Player that uses the winmm.dll (Uses Api). This was made using Visual Basic 6.0, but should work with any 32 Bit Visual Basic. | Download |
MPlay3 | hostyle | Source code from mPlay3. Shows basic mp3 playing functions: play, pause, stop, mute, previous file and next file(play) buttons. It also has load last directory. | Download |
String Encryption | gozer | Another way you can encrypt and decrypt text. This one's a bit more complicated than the other one. | Download |
String Encryption | Dracula X | An example on how to encrypt and decrypt text. | Download |
System Information | Craig Jasper, Jr. | An example on getting system information. [Made for Win2000] | Download |
System Wide Hotkeys | Craig Jasper, Jr. | An example of system wide hotkeys without a third party control. [VB5 and up] | [Missing] |
Tabstrip and Progressbar Control Example | patorjk | This is a small example on how to use the tabstrip control and the progressbar control. | Download |
Time Left Example | patorjk | This is an example on how to calculate how much time it will take to preform certain tasks. The idea will only work with things that loop over and over. | Download |
Treeview Example | Shawn N. | An example showing how to use the Treeview control found in MSComCtl.ocx. | Download |
Windows Resource Meter | Eric Osterheldt aka Deep Arctic | A resource meter that displays phyiscal, virtual, and page file memory. | [Missing] |
Windows Uptime | Eric Osterheldt aka Deep Arctic | An example that shows you how to find out how long Windows has been running (in months, weeks, hours, minutes, and seconds format). | [Missing] |
Word Count | Eric Osterheldt aka Deep Arctic | Shows a way of counting the number of words in a text box. Uses some Windows API. | Download |
Word Count | Eric Osterheldt aka Deep Arctic | Shows another way to count the number of words in a textbox. No Windows API functions are used here. | [Missing] |
Other VB resources | Tutorials | Programs | ActiveX Controls | Third Party Examples |
These pages collect example tutorials, programs and ActiveX controls displaying particular programming techniques in Visual Basic.
Further Assistance
Visual Basic Examples With Source Code Pdf
We cannot offer any further help with these examples. Most were developed by students who are no longer present. Our current students have moved onto programming in C#, and thus no longer use VB. Please do not contact us for further help, although feel free to tell us that this page was useful to you!
Other VB resources
- Planet Source Code.com has lots of searchable example programs and tutorials
- E-Commerce Webopedia: ActiveX controls is a page of links, but not sure how good it is for VB
Tutorials
These tutorials contain step by step graphical guides to several visual basicprogramming concepts and tools. Note that they are not necessarily in progressive order!
Tutorial | Description | Authors |
# 1 | Introduction to Visual Basic Part 1
| MikeRounding |
# 2 | Introduction to Visual Basic Part 2.
| MikeRounding |
# 3 | Accessing databases using the ADO Data Control | Mike Rounding |
# 4 | Accessing databases using the Data Environment control | Mike Rounding |
# 5 | Creating a simple HelloWorld ActiveX control in Visual Basic | Saul Greenberg |
# 6 | How to register your ActiveX Controls on the Computer Science machines | Mike Rounding |
# 7 | Building a Ticker ActiveX Control with the ActiveX Control Wizard | Mike Rounding |
# 8 | Building a Transparent ActiveX Control that lets you click on a non-rectangular image | Mike Rounding |
# 9 | Dynamic queries and databases: simple example on how you can use sliders to build a query to a database | Mike Rounding |
# 10 | The 'Bitton' control, beginning guide to building ActiveX controls a few different ways along with some ActiveX explanation | Mike Rounding |
# 11 | This program demonstrates dragging and dropping from explorer and between forms and also includes a cool control moving code module. | Mike Rounding Saul Greenberg |
# 12 | This is a step-by-step tutorial for how to integrate Macromedia Flash into your VB applications. Complete with instructions on how to pass information back and forth and also how to remotely invoke Flash methods right in VB! | Mike Hornby-Smith |
Programs
Project | Description | Authors |
vbHelloWorld | A simple hello world program that illustrates a basic VB program as well as the command button and timer control. | SaulGreenberg |
FirstProject | We use this nonsense program as a first VB exercise for students to do. The left figure shows when it looks like when the program is executed, while the right shows what happens after the user has clicked the button 3 times and selected the checkbox, and moved the mouse over the form. Try to program this yourself. It uses a command (or button), a label, and a checkbox. | James Tam |
vbImages | These two vb Projects illustrates two ways to cycle through images stored in a local directory. Each demonstrates different controls for accessing files, while both show a control for displaying images. | Saul Greenberg |
vbMarquee | A marquee (an automatically scrolling text region) is used to illustrate a Timer, a status bar and a checkbox control, and simple graphical repositioning, | Saul Greenberg |
vbMoveList | An example of how to use listboxes (as well as how to put images into buttons). This example lets you move items between lists. | Rod Stephens, modified by Saul Greenberg |
vbPlaysound | Illustrates how to play a wave file in Visual Basic. It works by declaring a function to the WIN32 API sndPlaySound . Don't be intimidated: its two lines of code! | Saul Greenberg |
vbSketchpads | Illustrates two simple sketchpads. The first one is only about 6 lines of code, and just illustrates some very basic graphics and event handling. The second shows how one can dynamically create controls at run time (the items on the palette), how controls can be positioned at runtime, and how controls can be resized when the window is resized. Its a longer program, but well worth going through to see how these features work. See Tutorial 2 for step by step instructions for how these programs work. | Saul Greenberg |
vbDrawpad | A simple object-oriented drawing editor that allows a user to create, move and erase squares. You can easily extend this to include different graphical classes e.g., circles, lines, etc., or to any interactive graphics. The program illustrates
| Saul Greenberg |
vbDynamicQueries | This program is similar to the drawing editor above, but used for completely different purposes. It illustrates how to do dynamic queries on city attributes, where cities on a map are filtered immediately as a person moves a slider or checks a checkbox. While the example is simple, the possibilities of how you can enhance it are endless. Click on the image to view it in full size. | Saul Greenberg |
vbTableLens | Illustrates how to create a very simple table lens that toggles cells between graphical and textual views. Click on the image to view it in full size. | Rod Stephens |
vbDragPicture | Illustrates how to Bitblit a picture on another picture, and how to drag it around. | Rod Stephens |
vbDragTreeNode | Illustrates how to use the Tree control and how to drag items around different parts of the tree | Rod Stephens |
vbMoveControls | An example application that lets a user interactively move different kinds of controls on a display. Illustrates interactive graphics. | Saul Greenberg |
vbclassexample | Illustrates how to create a simple class that raises events | Saul Greenberg |
vbFlexdata-example | Illustrates a database with the flex control. The database just has two fields: name and phone. This example lets you add and remove records. To make the grid sorted, we set the data control's record source property to the SQL statment: Select * from friends order by FirstName. The record is just added to the end of the file, but the flex grid shows it sorted. See also Tutorial 3 and Tutorial 4 for other ways to access databases. | Shaun Kaasten |
vbShapedControls | Illustrates how you can clip the shape of a control or form to a variety of regions. | Shaun Kaasten |
ActiveX Controls
Project | Description | Author |
HelloWorld | A tutorial and example project that shows you how to build a minimalist VB ActiveX Control Component. It just contains a label saying 'Hello World' and has no code attached to it. However, it does have a toolbox control icon. Includes an example program. | SaulGreenberg |
TickerTape | A tutorial and example project that shows you how to build a TickerTape control out of a label. It also illustrates the ActiveX Control Wizard. | Mike Rounding |
ElusiveProfessor | A VB ActiveX Control that creates a 'new' type of button (actually a standard but augmented command button) that moves away from the person who is trying to click it. Includes an example program. The design was based upon a class project where students had to design a button that reflected their personality. | Saul Greenberg |
FollowMe | This program creates a command button that will follow the mouse around. This simple but very useful example illustrates
| Michael Rounding |
vbRangeSlider | Illustrates a very crude range slider written in ActiveX. I include it to
It is limited. It does not scale its size, and I did not spend any time doing all the things that one normally does to package up a control. This is really just a quick hack. Feel free to improve it and pass it on to the class. To use: Unzip the file into a directory. Check out the test program in a sub directory that I included. In your own project, you can include the range slider by going into project/components and then selecting Browse. Navigate to the OCX file that will be in the unzipped directory and select it. You will see a new control that you can select. | Saul Greenberg |
PictureClip | A tutorial program that shows you how to use the PictureClip component for creating animations. | Dave Miller, 581 student |
ShowNeighbours | An activeX control plus exe that shows you how to find the other controls in a form from inside an ActiveX control. Saul Greenberg used this example to build a Mr. Popularity button, where all the other controls on the form gravitate towards a Mr Popularity ActiveX button. | Chris Bradley, 581 student |
xparent.zip | Illustrates how you can build a transparent ActiveX Control that lets you detect clicks on a non-rectangular image (in the figure on the right these would be the red letters). See Tutorial 8. | Mike Rounding, |
tranparent.zip | Similar to xparent.zip, except this version follows your mouse wherever it goes around the screen - very fun. | Mike Rounding, |
MovingControl.zip | This example includes a user control that will move itself towards any other control. This example illustrates some custom events and properties in a user control, and shows how to do do simple control animation with a timer. | Mike Rounding |
ThirdParty Examples
We've found these on the web or in books, and they are too good not toinclude
Project (as zip or .bas) | Description | Author |
animation | Bitmap Animation: Shows how to build a simple bitmap animation. | Rod Stephens |
Transparent.zip | Transparency: A tool library to do transparency, including transparent controls. | Doug Gaede |
vbRangeTool.zip | An ActiveX control that implements a range slider. Looks pretty good! | Author unknown |
VB-ScreenCapture.BAS | Capturing bitmaps: A BAS library for capturing various portions of a screen. |