Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95

View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?


"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP




Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Class: BitArray in Category General VBA/VB6 : Abstract Data Types from Total Visual SourceBook

Class that implements a bit array in VBA and VB6.

A bit array is an array of bit values, defined as 0 or 1. This class allocates 1 bit for each value you wish to store, resulting in significant memory savings. For example, suppose you wanted to maintain an array of 100 Boolean values. A single Boolean requires 2 bytes of memory, resulting in 200 bytes of memory. Using the bit-array technique available with this class, only 13 bytes of memory are consumed. A zero in the bit array would represent False, and a 1, True.

Procedure List

Procedure Name



(Declarations) Declarations Declarations and private variables for the CBitArray class
Bit Property Get the value of the bit specified in the lngBitNumber parameter
BitCount Property Get the number of bits that are set in the bit array
Count Property Get the number of bits represented in this class.

Example Code for Using Class: BitArray

' Example of CBitArray
' To try this example, do the following:
' 1. Create a new form
' 2. Add a command button 'cmdTest'
' 3. Paste all the code from this example to the new form's module
' 4. Run the form

Private Sub cmdTest_Click()
  Dim BitOps As CBitArray
  Dim lngCounter As Long

  Set BitOps = New CBitArray

  ' Set the number of bits to hold
  BitOps.Count = 100

  ' Set every 10 bits
  For lngCounter = 0 To 100 Step 10
    BitOps.Bit(lngCounter) = True
  Next lngCounter

  ' Test every five bits
  For lngCounter = 0 To 100 Step 5
    Debug.Print "Bit Number " & lngCounter & " is " & BitOps.Bit(lngCounter)
  Next lngCounter

  ' Indicate how many bits are set
  Debug.Print BitOps.BitCount & " bits are set to true"
End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources