Visual Basic Explorer
Visual Basic Explorer
 Navigation
 Home


 Coding
 Source Code

 FAQ Center

 VB Tips

 Downloads

 ToolBox

 Tutorials

 VB Games

 VB News

 VB Award

 VB Forums



 Affiliates
 Planet Source Code

 Rent a Coder

 DirectX4VB


 Misc
 Search

 Feedback

 Advertise

 About


Need to hire
a VB coder?

Please support our sponsor:

 Home 
 Site Map 
 Forums 
 News 
 Feedback 

Creating a VB4 32-bit Class Module to Simulate a Custom Control

Introduction

By Jeff Hargett

Creating a VB4 32-bit Class Module to Simulate a Custom Control - In this case a Simple Checked Listbox

Note: This project was originally created by Jeff Hargett on his popular VB4UandMe site which he has since closed down. His site was one that I used as a model of what constituted a 'good' VB site when I set about building Visual Basic Explorer. This project was an early experiment by Jeff when class modules were first added to VB. A lot of work went into this one and I think you may still find it interesting.

I hope you have some time because this one is a long one. Probably the longest source code example you will see on VB4UandME. It will undoubtedly take me a good while to whip up decent documentation and step by step instructions for doing this because this example creates a very useful Object-Oriented Custom Control in VB4 by utilizing the newly available class modules.

Now, before I start let me make a few things VERY CLEAR!

1) I had no one to ask for advice while I was creating this control so some of the techniques may not meet with the approval of some of you gurus out there, but hey, it's all my creation and I did this project simply as a learning exercise. Now, I'm gonna pass that knowledge on to everyone else.

2) This tutorial is quite long! As a result, I will be making the complete source code available as a download, but not until I have completed ALL of these tutorial pages that go along with it. It is not my intention to be flooded with 50 emails a day seeking advice on problems encountered while testing the code put forth in these examples. It's not that I'm an "axx-hole", it's just that I barely have the time now to maintain this web site. (This site already generates a lot of email and I answer each one personally - no auto-answer-bots are used!).

3) At the conclusion of these tutorials, I will be opening up a message-board type of discussion area to publish questions, comments, complaints, and such sent from those of you who have followed through this tutorial. The primary purpose here is to allow you the user to enhance this control into making it what you want. Discussion of the programming concepts and techniques involved will enable you to do just that.

Here's what the control (Simple Checked Listbox) looks like when used in an actual application I wrote:

An Overview of this tutorial.

  • Step 1: Determine exactly what it is we want to create
  • Step 2: Lay out the visual interface (design the form)
  • Step 3: Make the form work (coding the form's event procedures)
  • Step 4: Setting up some methods (coding the class module)
  • Step 5: Setting up some properties (coding the class module)
  • Step 6: Tie up all the loose ends
  • Step 7: Make this baby an OLE-DLL
  • Step 8: Create a small client application to test the DLL

Now, obviously, this is not just an 8 lesson tutorial. Many of the Steps mentioned above will consist of many Sub-steps in order to accomplish our goal. Please let me apologize in advance if this tutorial does not flow smoothly. I have not posted many source code examples in a while so I don't want to wait until I have this thing finished before posting, therefore, some of these steps could conceivably be altered in the course of creating this tutorial. Bear with me, I'll do my best to present this material in as organized fashion as possible.

The actual project from which this tutorial comes consists of three files:

  1. frmList - The actual Listbox form
  2. basList - Global module
  3. JSHSCLB - The Class Module itself.

The plan of attack!


Determine exactly what it is we want to create
Lay out the visual interface
Make the form work
Setting up some methods
Setting up some properties
Tie up all the loose ends
Make this baby an OLE-DLL
Create a small client application to test the DLL
--------------------------------------------
Original tip and project submitted 
by Jeff Hargett. Minor text 
editing by Burt Abreu.
--------------------------------------------

Download VB4 Sample





Home | About | What's New | Source Code | FAQ | Tips & Tricks | Downloads | ToolBox | Tutorials | Game Programming | VB Award | Search | VB Forums | Feedback | VBNews | Copyright & Disclaimer | Advertise | Privacy Policy |

Quick searches: Site Search | Advanced Site Search 

Copyright 2002 by Exhedra Solutions, Inc.
By using this site you agree to its terms and conditions
VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc.